From 5f9f3c8de8d5d9f83a437661a98e5cc2453705f9 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Fri, 22 Nov 2019 17:42:58 -0500 Subject: vlib: autogenerate before constraints If an arc declaration includes '.last_in_arc = "some-node"', assume that folks mean it and add explicit ordering constraints. Fix the "arp" arc declaration which claimed that the arc ends at arp-disabled, but the arc really ends at error-drop. Type: fix Signed-off-by: Dave Barach Change-Id: Ie2de1fb30091671cbc7c62770903a2e05987f141 --- src/vnet/feature/registration.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/vnet/feature/registration.c') diff --git a/src/vnet/feature/registration.c b/src/vnet/feature/registration.c index fb10fbbe0db..030486a7489 100644 --- a/src/vnet/feature/registration.c +++ b/src/vnet/feature/registration.c @@ -122,6 +122,7 @@ vnet_feature_arc_init (vlib_main_t * vm, vnet_config_main_t * vcm, char **feature_start_nodes, int num_feature_start_nodes, + char *last_in_arc, vnet_feature_registration_t * first_reg, vnet_feature_constraint_registration_t * first_const_set, char ***in_feature_nodes) @@ -154,6 +155,27 @@ vnet_feature_arc_init (vlib_main_t * vm, this_reg = first_reg; + /* Autogenerate before constraints */ + if (last_in_arc) + { + while (this_reg) + { + /* If this isn't the last node in the arc... */ + if (clib_strcmp (this_reg->node_name, last_in_arc)) + { + /* + * Add an explicit constraint so this feature will run + * before the last node in the arc + */ + constraint_tuple = format (0, "%s,%s%c", this_reg->node_name, + last_in_arc, 0); + vec_add1 (constraints, constraint_tuple); + } + this_reg = this_reg->next_in_arc; + } + this_reg = first_reg; + } + /* pass 1, collect feature node names, construct a before b pairs */ while (this_reg) { -- cgit 1.2.3-korg