summaryrefslogtreecommitdiff
path: root/proto/static
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-07-24 15:38:32 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-07-24 15:38:32 +0200
commitcec40a74679821513e627f93b924067a404f6475 (patch)
tree793bbe5b326e7008e4657cf11b2937cafbe3d922 /proto/static
parent18f70a6229f586d5e4f387075be42d7a1ef5d269 (diff)
parent8263690e754a83b8f3c58bd0080a1628d6cba556 (diff)
Merge remote-tracking branch 'origin/mq-filter-stack'
Diffstat (limited to 'proto/static')
-rw-r--r--proto/static/config.Y17
-rw-r--r--proto/static/static.c2
-rw-r--r--proto/static/static.h2
3 files changed, 15 insertions, 6 deletions
diff --git a/proto/static/config.Y b/proto/static/config.Y
index d7a02961..6e410879 100644
--- a/proto/static/config.Y
+++ b/proto/static/config.Y
@@ -14,7 +14,7 @@ CF_DEFINES
#define STATIC_CFG ((struct static_config *) this_proto)
static struct static_route *this_srt, *this_snh;
-static struct f_inst **this_srt_last_cmd;
+static struct f_inst *this_srt_cmds, *this_srt_last_cmd;
static struct static_route *
static_nexthop_new(void)
@@ -39,6 +39,8 @@ static_route_finish(void)
{
if (net_type_match(this_srt->net, NB_DEST) == !this_srt->dest)
cf_error("Unexpected or missing nexthop/type");
+
+ this_srt->cmds = f_linearize(this_srt_cmds);
}
CF_DECLS
@@ -108,7 +110,8 @@ stat_route0: ROUTE net_any {
this_srt = cfg_allocz(sizeof(struct static_route));
add_tail(&STATIC_CFG->routes, &this_srt->n);
this_srt->net = $2;
- this_srt_last_cmd = &(this_srt->cmds);
+ this_srt_cmds = NULL;
+ this_srt_last_cmd = NULL;
this_srt->mp_next = NULL;
this_snh = NULL;
}
@@ -134,7 +137,13 @@ stat_route:
;
stat_route_item:
- cmd { *this_srt_last_cmd = $1; this_srt_last_cmd = &($1->next); }
+ cmd {
+ if (this_srt_last_cmd)
+ this_srt_last_cmd->next = $1;
+ else
+ this_srt_cmds = $1;
+ this_srt_last_cmd = $1;
+ }
;
stat_route_opts:
@@ -148,7 +157,7 @@ stat_route_opt_list:
;
-CF_CLI(SHOW STATIC, optsym, [<name>], [[Show details of static protocol]])
+CF_CLI(SHOW STATIC, optproto, [<name>], [[Show details of static protocol]])
{ static_show(proto_get_named($3, &proto_static)); } ;
CF_CODE
diff --git a/proto/static/static.c b/proto/static/static.c
index 60926349..c899cc87 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -309,7 +309,7 @@ static inline int
static_same_rte(struct static_route *or, struct static_route *nr)
{
/* Note that i_same() requires arguments in (new, old) order */
- return static_same_dest(or, nr) && i_same(nr->cmds, or->cmds);
+ return static_same_dest(or, nr) && f_same(nr->cmds, or->cmds);
}
static void
diff --git a/proto/static/static.h b/proto/static/static.h
index a3c30b87..f736996c 100644
--- a/proto/static/static.h
+++ b/proto/static/static.h
@@ -39,7 +39,7 @@ struct static_route {
struct static_route *chain; /* Next for the same neighbor */
struct static_route *mp_head; /* First nexthop of this route */
struct static_route *mp_next; /* Nexthops for multipath routes */
- struct f_inst *cmds; /* List of commands for setting attributes */
+ struct f_line *cmds; /* List of commands for setting attributes */
byte dest; /* Destination type (RTD_*) */
byte state; /* State of route announcement (SRS_*) */
byte active; /* Next hop is active (nbr/iface/BFD available) */