diff options
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/classify/ip_classify.c | 32 | ||||
-rw-r--r-- | vnet/vnet/ip/ip4_forward.c | 33 | ||||
-rw-r--r-- | vnet/vnet/ip/ip4_hop_by_hop.c | 48 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_forward.c | 16 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_hop_by_hop.c | 51 | ||||
-rw-r--r-- | vnet/vnet/ip/lookup.h | 32 |
6 files changed, 44 insertions, 168 deletions
diff --git a/vnet/vnet/classify/ip_classify.c b/vnet/vnet/classify/ip_classify.c index ba5269e2a62..55c08e0ceeb 100644 --- a/vnet/vnet/classify/ip_classify.c +++ b/vnet/vnet/classify/ip_classify.c @@ -323,21 +323,7 @@ VLIB_REGISTER_NODE (ip4_classify_node) = { .error_strings = ip_classify_error_strings, .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip4-miss", - [IP_LOOKUP_NEXT_DROP] = "ip4-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", - [IP_LOOKUP_NEXT_ARP] = "ip4-arp", - [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", /* probably not... */ - [IP_LOOKUP_NEXT_MAP] = "ip4-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", - }, + .next_nodes = IP4_LOOKUP_NEXT_NODES, }; static uword @@ -358,21 +344,7 @@ VLIB_REGISTER_NODE (ip6_classify_node) = { .error_strings = ip_classify_error_strings, .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip6-miss", - [IP_LOOKUP_NEXT_DROP] = "ip6-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", - [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", - [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", /* probably not... */ - [IP_LOOKUP_NEXT_MAP] = "ip6-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd", - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", - }, + .next_nodes = IP6_LOOKUP_NEXT_NODES, }; static clib_error_t * diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c index e099cd9d047..ef3624a8171 100644 --- a/vnet/vnet/ip/ip4_forward.c +++ b/vnet/vnet/ip/ip4_forward.c @@ -1301,27 +1301,14 @@ ip4_sw_interface_add_del (vnet_main_t * vnm, VNET_SW_INTERFACE_ADD_DEL_FUNCTION (ip4_sw_interface_add_del); + VLIB_REGISTER_NODE (ip4_lookup_node) = { .function = ip4_lookup, .name = "ip4-lookup", .vector_size = sizeof (u32), .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip4-miss", - [IP_LOOKUP_NEXT_DROP] = "ip4-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", - [IP_LOOKUP_NEXT_ARP] = "ip4-arp", - [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", - [IP_LOOKUP_NEXT_MAP] = "ip4-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", - }, + .next_nodes = IP4_LOOKUP_NEXT_NODES, }; /* Global IP4 main. */ @@ -2979,21 +2966,7 @@ VLIB_REGISTER_NODE (ip4_lookup_multicast_node,static) = { .vector_size = sizeof (u32), .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip4-miss", - [IP_LOOKUP_NEXT_DROP] = "ip4-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", - [IP_LOOKUP_NEXT_ARP] = "ip4-arp", - [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", - [IP_LOOKUP_NEXT_MAP] = "ip4-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", - }, + .next_nodes = IP4_LOOKUP_NEXT_NODES, }; VLIB_REGISTER_NODE (ip4_multicast_node,static) = { diff --git a/vnet/vnet/ip/ip4_hop_by_hop.c b/vnet/vnet/ip/ip4_hop_by_hop.c index db6a50f271f..ae46040a5d3 100644 --- a/vnet/vnet/ip/ip4_hop_by_hop.c +++ b/vnet/vnet/ip/ip4_hop_by_hop.c @@ -230,21 +230,7 @@ VLIB_REGISTER_NODE (ip4_hop_by_hop_node) = { /* See ip/lookup.h */ .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip4-miss", - [IP_LOOKUP_NEXT_DROP] = "ip4-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", - [IP_LOOKUP_NEXT_ARP] = "ip4-arp", - [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", - [IP_LOOKUP_NEXT_MAP] = "ip4-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", /* probably not */ - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", - }, + .next_nodes = IP4_LOOKUP_NEXT_NODES, }; VLIB_REGISTER_NODE (ip4_add_hop_by_hop_node) = { @@ -259,21 +245,7 @@ VLIB_REGISTER_NODE (ip4_add_hop_by_hop_node) = { /* See ip/lookup.h */ .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip4-miss", - [IP_LOOKUP_NEXT_DROP] = "ip4-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", - [IP_LOOKUP_NEXT_ARP] = "ip4-arp", - [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", - [IP_LOOKUP_NEXT_MAP] = "ip4-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", /* probably not */ - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", - }, + .next_nodes = IP4_LOOKUP_NEXT_NODES, }; VLIB_REGISTER_NODE (ip4_pop_hop_by_hop_node) = { @@ -288,21 +260,7 @@ VLIB_REGISTER_NODE (ip4_pop_hop_by_hop_node) = { /* See ip/lookup.h */ .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip4-miss", - [IP_LOOKUP_NEXT_DROP] = "ip4-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", - [IP_LOOKUP_NEXT_ARP] = "ip4-arp", - [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", - [IP_LOOKUP_NEXT_MAP] = "ip4-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", /* probably not */ - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", - }, + .next_nodes = IP4_LOOKUP_NEXT_NODES, }; static clib_error_t * diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c index 6c8d18d6d58..a79bae6905a 100644 --- a/vnet/vnet/ip/ip6_forward.c +++ b/vnet/vnet/ip/ip6_forward.c @@ -1173,21 +1173,7 @@ VLIB_REGISTER_NODE (ip6_lookup_node) = { .vector_size = sizeof (u32), .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip6-miss", - [IP_LOOKUP_NEXT_DROP] = "ip6-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", - [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", - [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", - [IP_LOOKUP_NEXT_MAP] = "ip6-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd", - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", - }, + .next_nodes = IP6_LOOKUP_NEXT_NODES, }; typedef struct { diff --git a/vnet/vnet/ip/ip6_hop_by_hop.c b/vnet/vnet/ip/ip6_hop_by_hop.c index 50dc38b7fed..057d16cec1d 100644 --- a/vnet/vnet/ip/ip6_hop_by_hop.c +++ b/vnet/vnet/ip/ip6_hop_by_hop.c @@ -497,22 +497,7 @@ VLIB_REGISTER_NODE (ip6_hop_by_hop_node) = { /* See ip/lookup.h */ .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip6-miss", - [IP_LOOKUP_NEXT_DROP] = "ip6-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", - [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", - [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", - [IP_LOOKUP_NEXT_MAP] = "ip6-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd", - /* Next 3 arcs probably never used */ - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", - }, + .next_nodes = IP6_LOOKUP_NEXT_NODES, }; /* The main h-b-h tracer will be invoked, no need to do much here */ @@ -729,22 +714,7 @@ VLIB_REGISTER_NODE (ip6_add_hop_by_hop_node) = { /* See ip/lookup.h */ .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip6-miss", - [IP_LOOKUP_NEXT_DROP] = "ip6-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", - [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", - [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", - [IP_LOOKUP_NEXT_MAP] = "ip6-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd", - /* Next 3 arcs probably never used */ - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", - }, + .next_nodes = IP6_LOOKUP_NEXT_NODES, }; @@ -980,22 +950,7 @@ VLIB_REGISTER_NODE (ip6_pop_hop_by_hop_node) = { /* See ip/lookup.h */ .n_next_nodes = IP_LOOKUP_N_NEXT, - .next_nodes = { - [IP_LOOKUP_NEXT_MISS] = "ip6-miss", - [IP_LOOKUP_NEXT_DROP] = "ip6-drop", - [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", - [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", - [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", - [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", - [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", - [IP_LOOKUP_NEXT_MAP] = "ip6-map", - [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t", - [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd", - /* Next 3 arcs probably never used */ - [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", - [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", - [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", - }, + .next_nodes = IP6_LOOKUP_NEXT_NODES, }; diff --git a/vnet/vnet/ip/lookup.h b/vnet/vnet/ip/lookup.h index fcac675d899..76d803d2699 100644 --- a/vnet/vnet/ip/lookup.h +++ b/vnet/vnet/ip/lookup.h @@ -86,6 +86,38 @@ typedef enum { IP_LOOKUP_N_NEXT, } ip_lookup_next_t; +#define IP4_LOOKUP_NEXT_NODES { \ + [IP_LOOKUP_NEXT_MISS] = "ip4-miss", \ + [IP_LOOKUP_NEXT_DROP] = "ip4-drop", \ + [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", \ + [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", \ + [IP_LOOKUP_NEXT_ARP] = "ip4-arp", \ + [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", \ + [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", \ + [IP_LOOKUP_NEXT_MAP] = "ip4-map", \ + [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", \ + [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", \ + [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", \ + [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", \ + [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", \ +} + +#define IP6_LOOKUP_NEXT_NODES { \ + [IP_LOOKUP_NEXT_MISS] = "ip6-miss", \ + [IP_LOOKUP_NEXT_DROP] = "ip6-drop", \ + [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", \ + [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", \ + [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", \ + [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", \ + [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", \ + [IP_LOOKUP_NEXT_MAP] = "ip6-map", \ + [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t", \ + [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd", \ + [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", \ + [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", \ + [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", \ +} + /* Flow hash configuration */ #define IP_FLOW_HASH_SRC_ADDR (1<<0) #define IP_FLOW_HASH_DST_ADDR (1<<1) |