summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vlib/vlib/main.c12
-rw-r--r--vlib/vlib/node.c83
-rw-r--r--vnet/vnet/ip/ip4_forward.c6
-rw-r--r--vnet/vnet/ip/ip6_forward.c9
-rw-r--r--vnet/vnet/sr/sr.c15
5 files changed, 48 insertions, 77 deletions
diff --git a/vlib/vlib/main.c b/vlib/vlib/main.c
index 24504e74080..f7a27cfd6bb 100644
--- a/vlib/vlib/main.c
+++ b/vlib/vlib/main.c
@@ -1570,12 +1570,6 @@ int vlib_main (vlib_main_t * vm, unformat_input_t * input)
vm->random_seed = clib_cpu_time_now ();
clib_random_buffer_init (&vm->random_buffer, vm->random_seed);
- /* See unix/main.c; most likely already set up */
- if (vm->init_functions_called == 0)
- vm->init_functions_called = hash_create (0, /* value bytes */ 0);
- if ((error = vlib_call_all_init_functions (vm)))
- goto done;
-
/* Initialize node graph. */
if ((error = vlib_node_main_init (vm)))
{
@@ -1586,6 +1580,12 @@ int vlib_main (vlib_main_t * vm, unformat_input_t * input)
goto done;
}
+ /* See unix/main.c; most likely already set up */
+ if (vm->init_functions_called == 0)
+ vm->init_functions_called = hash_create (0, /* value bytes */ 0);
+ if ((error = vlib_call_all_init_functions (vm)))
+ goto done;
+
/* Create default buffer free list. */
vlib_buffer_get_or_create_free_list (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES,
"default");
diff --git a/vlib/vlib/node.c b/vlib/vlib/node.c
index 7378701ab4d..5d250d00a6f 100644
--- a/vlib/vlib/node.c
+++ b/vlib/vlib/node.c
@@ -163,17 +163,8 @@ vlib_node_add_next_with_slot (vlib_main_t * vm,
node = vec_elt (nm->nodes, node_index);
next = vec_elt (nm->nodes, next_node_index);
- /* Fill in static next nodes if runtime has yet to be initialized. */
- if (slot == ~0 && ! (nm->flags & VLIB_NODE_MAIN_RUNTIME_STARTED))
- {
- uword i;
- for (i = 0; i < vec_len (node->next_node_names); i++)
- {
- char * a = node->next_node_names[i];
- if (a)
- vlib_node_add_named_next_with_slot (vm, node->index, a, i);
- }
- }
+ /* Runtime has to be initialized. */
+ ASSERT(nm->flags & VLIB_NODE_MAIN_RUNTIME_STARTED);
if ((p = hash_get (node->next_slot_by_node, next_node_index)))
{
@@ -315,6 +306,8 @@ static void register_node (vlib_main_t * vm,
/* Node index of next sibling will be filled in by vlib_node_main_init. */
n->sibling_of = r->sibling_of;
+ if (r->sibling_of && r->n_next_nodes > 0)
+ clib_error ("sibling node should not have any next nodes `%v'", n->name);
if (r->type == VLIB_NODE_TYPE_INTERNAL)
ASSERT (r->vector_size > 0);
@@ -473,6 +466,40 @@ vlib_node_main_init (vlib_main_t * vm)
nm->flags |= VLIB_NODE_MAIN_RUNTIME_STARTED;
+ /* Generate sibling relationships */
+ {
+ vlib_node_t * n, * sib;
+ uword si;
+
+ for (ni = 0; ni < vec_len (nm->nodes); ni++)
+ {
+ n = vec_elt (nm->nodes, ni);
+
+ if (! n->sibling_of)
+ continue;
+
+ sib = vlib_get_node_by_name (vm, (u8 *) n->sibling_of);
+ if (! sib)
+ clib_error ("sibling `%s' not found for node `%v'", n->sibling_of, n->name);
+
+ clib_bitmap_foreach (si, sib->sibling_bitmap, ({
+ vlib_node_t * m = vec_elt (nm->nodes, si);
+
+ /* Connect all of sibling's siblings to us. */
+ m->sibling_bitmap = clib_bitmap_ori (m->sibling_bitmap, n->index);
+
+ /* Connect us to all of sibling's siblings. */
+ n->sibling_bitmap = clib_bitmap_ori (n->sibling_bitmap, si);
+ }));
+
+ /* Connect sibling to us. */
+ sib->sibling_bitmap = clib_bitmap_ori (sib->sibling_bitmap, n->index);
+
+ /* Connect us to sibling. */
+ n->sibling_bitmap = clib_bitmap_ori (n->sibling_bitmap, sib->index);
+ }
+ }
+
/* Resolve next names into next indices. */
for (ni = 0; ni < vec_len (nm->nodes); ni++)
{
@@ -545,40 +572,6 @@ vlib_node_main_init (vlib_main_t * vm)
}
}
- /* Generate node sibling relationships. */
- {
- vlib_node_t * n, * sib;
- uword si;
-
- for (ni = 0; ni < vec_len (nm->nodes); ni++)
- {
- n = vec_elt (nm->nodes, ni);
-
- if (! n->sibling_of)
- continue;
-
- sib = vlib_get_node_by_name (vm, (u8 *) n->sibling_of);
- if (! sib)
- clib_error ("sibling `%s' not found for node `%v'", n->sibling_of, n->name);
-
- clib_bitmap_foreach (si, sib->sibling_bitmap, ({
- vlib_node_t * m = vec_elt (nm->nodes, si);
-
- /* Connect all of sibling's siblings to us. */
- m->sibling_bitmap = clib_bitmap_ori (m->sibling_bitmap, n->index);
-
- /* Connect us to all of sibling's siblings. */
- n->sibling_bitmap = clib_bitmap_ori (n->sibling_bitmap, si);
- }));
-
- /* Connect sibling to us. */
- sib->sibling_bitmap = clib_bitmap_ori (sib->sibling_bitmap, n->index);
-
- /* Connect us to sibling. */
- n->sibling_bitmap = clib_bitmap_ori (n->sibling_bitmap, sib->index);
- }
- }
-
done:
return error;
}
diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c
index 46b3a97b7c1..c08870919fc 100644
--- a/vnet/vnet/ip/ip4_forward.c
+++ b/vnet/vnet/ip/ip4_forward.c
@@ -2810,11 +2810,7 @@ VLIB_REGISTER_NODE (ip4_rewrite_local_node) = {
.format_trace = format_ip4_rewrite_trace,
- .n_next_nodes = 2,
- .next_nodes = {
- [IP4_REWRITE_NEXT_DROP] = "error-drop",
- [IP4_REWRITE_NEXT_ARP] = "ip4-arp",
- },
+ .n_next_nodes = 0,
};
VLIB_NODE_FUNCTION_MULTIARCH (ip4_rewrite_local_node, ip4_rewrite_local)
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c
index 398d0926e83..cedc5cdde88 100644
--- a/vnet/vnet/ip/ip6_forward.c
+++ b/vnet/vnet/ip/ip6_forward.c
@@ -2492,10 +2492,7 @@ VLIB_REGISTER_NODE (ip6_rewrite_local_node) = {
.format_trace = format_ip6_rewrite_trace,
- .n_next_nodes = 1,
- .next_nodes = {
- [IP6_REWRITE_NEXT_DROP] = "error-drop",
- },
+ .n_next_nodes = 0,
};
VLIB_NODE_FUNCTION_MULTIARCH (ip6_rewrite_local_node, ip6_rewrite_local)
@@ -2711,13 +2708,13 @@ ip6_hop_by_hop (vlib_main_t * vm,
VLIB_REGISTER_NODE (ip6_hop_by_hop_node) = {
.function = ip6_hop_by_hop,
.name = "ip6-hop-by-hop",
+ .sibling_of = "ip6-lookup",
.vector_size = sizeof (u32),
.format_trace = format_ip6_hop_by_hop_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN(ip6_hop_by_hop_error_strings),
.error_strings = ip6_hop_by_hop_error_strings,
- .n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = IP6_LOOKUP_NEXT_NODES,
+ .n_next_nodes = 0,
};
VLIB_NODE_FUNCTION_MULTIARCH (ip6_hop_by_hop_node, ip6_hop_by_hop)
diff --git a/vnet/vnet/sr/sr.c b/vnet/vnet/sr/sr.c
index e7992ad92ae..845bf95c423 100644
--- a/vnet/vnet/sr/sr.c
+++ b/vnet/vnet/sr/sr.c
@@ -1953,8 +1953,6 @@ static clib_error_t * sr_init (vlib_main_t * vm)
ip6_sr_main_t * sm = &sr_main;
clib_error_t * error = 0;
vlib_node_t * ip6_lookup_node, * ip6_rewrite_node;
- vlib_node_t * ip6_rewrite_local_node;
- u32 verify_next_index;
if ((error = vlib_call_init_function (vm, ip_main_init)))
return error;
@@ -1989,10 +1987,6 @@ static clib_error_t * sr_init (vlib_main_t * vm)
ip6_rewrite_node = vlib_get_node_by_name (vm, (u8 *)"ip6-rewrite");
ASSERT(ip6_rewrite_node);
-
- ip6_rewrite_local_node = vlib_get_node_by_name (vm,
- (u8 *)"ip6-rewrite-local");
- ASSERT(ip6_rewrite_local_node);
/* Add a disposition to ip6_lookup for the sr rewrite node */
sm->ip6_lookup_sr_next_index =
@@ -2008,15 +2002,6 @@ static clib_error_t * sr_init (vlib_main_t * vm)
sm->ip6_rewrite_sr_next_index =
vlib_node_add_next (vm, ip6_rewrite_node->index,
sr_fix_dst_addr_node.index);
- /*
- * Fix ip6-rewrite-local, sibling of the above. The sibling bitmap
- * isn't set up at this point, so we have to do it manually
- */
- verify_next_index = vlib_node_add_next
- (vm, ip6_rewrite_local_node->index,
- sr_fix_dst_addr_node.index);
-
- ASSERT(sm->ip6_rewrite_sr_next_index == verify_next_index);
OpenSSL_add_all_digests();