summaryrefslogtreecommitdiff
path: root/proto/static/config.Y
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-03-07 18:42:41 +0100
committerJan Moskyto Matejka <mq@ucw.cz>2017-03-09 13:47:00 +0100
commit7126cadf80fce1af2bb4aa33f8bcb7c6b5ff1a47 (patch)
treea1603efe3e773106b08ba5b2766af2e5406dcd5b /proto/static/config.Y
parent5ffb62dd034db0beab5ef245ad7dd31aadefb2d8 (diff)
Static: Minor overhaul
The patch fixes several bugs introduced in previous changes, simplifies the protocol by handing routes uniformly, introduces asynchronous route processing to avoid issues with separate notifications for each next-hop in ECMP routes, and makes reconfiguration faster by avoiding quadratic complexity.
Diffstat (limited to 'proto/static/config.Y')
-rw-r--r--proto/static/config.Y18
1 files changed, 5 insertions, 13 deletions
diff --git a/proto/static/config.Y b/proto/static/config.Y
index 16c276ce..86fcedec 100644
--- a/proto/static/config.Y
+++ b/proto/static/config.Y
@@ -19,15 +19,9 @@ static struct f_inst **this_srt_last_cmd;
static struct static_route *
static_nexthop_new(void)
{
- struct static_route *nh;
+ struct static_route *nh = this_srt;
- if (!this_snh)
- {
- /* First next hop */
- nh = this_srt;
- rem_node(&this_srt->n);
- }
- else
+ if (this_snh)
{
/* Additional next hop */
nh = cfg_allocz(sizeof(struct static_route));
@@ -57,7 +51,7 @@ CF_ADDTO(proto, static_proto '}')
static_proto_start: proto_start STATIC
{
this_proto = proto_config_new(&proto_static, $1);
- static_init_config(STATIC_CFG);
+ init_list(&STATIC_CFG->routes);
};
static_proto:
@@ -74,13 +68,11 @@ stat_nexthop:
this_snh = static_nexthop_new();
this_snh->via = $2;
this_snh->iface = $3;
- add_tail(&STATIC_CFG->neigh_routes, &this_snh->n);
}
| VIA TEXT {
this_snh = static_nexthop_new();
this_snh->via = IPA_NONE;
- this_snh->if_name = $2;
- add_tail(&STATIC_CFG->iface_routes, &this_snh->n);
+ this_snh->iface = if_get_by_name($2);
}
| stat_nexthop MPLS label_stack {
this_snh->label_count = $3[0];
@@ -102,7 +94,7 @@ stat_nexthops:
stat_route0: ROUTE net_any {
this_srt = cfg_allocz(sizeof(struct static_route));
- add_tail(&STATIC_CFG->other_routes, &this_srt->n);
+ add_tail(&STATIC_CFG->routes, &this_srt->n);
this_srt->net = $2;
this_srt_last_cmd = &(this_srt->cmds);
this_srt->mp_next = NULL;