summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/adj/adj_internal.h31
-rw-r--r--vnet/vnet/adj/adj_midchain.c51
-rw-r--r--vnet/vnet/adj/adj_nbr.c18
-rw-r--r--vnet/vnet/adj/adj_nbr.h4
-rw-r--r--vnet/vnet/adj/adj_rewrite.c2
-rw-r--r--vnet/vnet/adj/adj_rewrite.h2
-rw-r--r--vnet/vnet/fib/fib_entry_src.c2
-rw-r--r--vnet/vnet/fib/fib_path.c2
-rw-r--r--vnet/vnet/fib/fib_test.c36
-rw-r--r--vnet/vnet/fib/fib_types.c42
-rw-r--r--vnet/vnet/fib/fib_types.h42
-rw-r--r--vnet/vnet/fib/fib_walk.c2
-rw-r--r--vnet/vnet/gre/interface.c2
-rw-r--r--vnet/vnet/interface.h14
-rw-r--r--vnet/vnet/ip/ip4_source_and_port_range_check.c2
-rw-r--r--vnet/vnet/ip/ip6_neighbor.c6
-rw-r--r--vnet/vnet/ip/lookup.h2
-rw-r--r--vnet/vnet/lisp-gpe/lisp_gpe_adjacency.c13
-rw-r--r--vpp/app/vpe_cli.c2
-rw-r--r--vpp/vpp-api/api.c3
20 files changed, 122 insertions, 156 deletions
diff --git a/vnet/vnet/adj/adj_internal.h b/vnet/vnet/adj/adj_internal.h
index f882bff84c0..8c9665972c6 100644
--- a/vnet/vnet/adj/adj_internal.h
+++ b/vnet/vnet/adj/adj_internal.h
@@ -42,36 +42,21 @@
#endif
static inline u32
-adj_get_rewrite_node (fib_link_t linkt)
+adj_get_rewrite_node (vnet_link_t linkt)
{
switch (linkt) {
- case FIB_LINK_IP4:
+ case VNET_LINK_IP4:
return (ip4_rewrite_node.index);
- case FIB_LINK_IP6:
+ case VNET_LINK_IP6:
return (ip6_rewrite_node.index);
- case FIB_LINK_MPLS:
+ case VNET_LINK_MPLS:
return (mpls_output_node.index);
- case FIB_LINK_ETHERNET:
+ case VNET_LINK_ETHERNET:
return (adj_l2_rewrite_node.index);
- }
- ASSERT(0);
- return (0);
-}
-
-static inline vnet_l3_packet_type_t
-adj_fib_link_2_vnet (fib_link_t linkt)
-{
- switch (linkt)
- {
- case FIB_LINK_IP4:
- return (VNET_L3_PACKET_TYPE_IP4);
- case FIB_LINK_IP6:
- return (VNET_L3_PACKET_TYPE_IP6);
- case FIB_LINK_MPLS:
- return (VNET_L3_PACKET_TYPE_MPLS_UNICAST);
- case FIB_LINK_ETHERNET:
+ case VNET_LINK_ARP:
break;
}
+ ASSERT(0);
return (0);
}
@@ -109,7 +94,7 @@ extern void adj_nbr_update_rewrite_internal (ip_adjacency_t *adj,
extern ip_adjacency_t * adj_alloc(fib_protocol_t proto);
extern void adj_nbr_remove(fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index);
extern void adj_glean_remove(fib_protocol_t proto,
diff --git a/vnet/vnet/adj/adj_midchain.c b/vnet/vnet/adj/adj_midchain.c
index 9f6c8e474d8..136f69bdd81 100644
--- a/vnet/vnet/adj/adj_midchain.c
+++ b/vnet/vnet/adj/adj_midchain.c
@@ -24,8 +24,8 @@
/**
* The two midchain tx feature node indices
*/
-static u32 adj_midchain_tx_feature_node[FIB_LINK_NUM];
-static u32 adj_midchain_tx_no_count_feature_node[FIB_LINK_NUM];
+static u32 adj_midchain_tx_feature_node[VNET_LINK_NUM];
+static u32 adj_midchain_tx_no_count_feature_node[VNET_LINK_NUM];
/**
* @brief Trace data for packets traversing the midchain tx node
@@ -178,56 +178,58 @@ VLIB_REGISTER_NODE (adj_midchain_tx_no_count_node, static) = {
VNET_IP4_TX_FEATURE_INIT (adj_midchain_tx_ip4, static) = {
.node_name = "adj-midchain-tx",
.runs_before = ORDER_CONSTRAINTS {"interface-output"},
- .feature_index = &adj_midchain_tx_feature_node[FIB_LINK_IP4],
+ .feature_index = &adj_midchain_tx_feature_node[VNET_LINK_IP4],
};
VNET_IP4_TX_FEATURE_INIT (adj_midchain_tx_no_count_ip4, static) = {
.node_name = "adj-midchain-tx-no-count",
.runs_before = ORDER_CONSTRAINTS {"interface-output"},
- .feature_index = &adj_midchain_tx_no_count_feature_node[FIB_LINK_IP4],
+ .feature_index = &adj_midchain_tx_no_count_feature_node[VNET_LINK_IP4],
};
VNET_IP6_TX_FEATURE_INIT (adj_midchain_tx_ip6, static) = {
.node_name = "adj-midchain-tx",
.runs_before = ORDER_CONSTRAINTS {"interface-output"},
- .feature_index = &adj_midchain_tx_feature_node[FIB_LINK_IP6],
+ .feature_index = &adj_midchain_tx_feature_node[VNET_LINK_IP6],
};
VNET_IP6_TX_FEATURE_INIT (adj_midchain_tx_no_count_ip6, static) = {
.node_name = "adj-midchain-tx-no-count",
.runs_before = ORDER_CONSTRAINTS {"interface-output"},
- .feature_index = &adj_midchain_tx_no_count_feature_node[FIB_LINK_IP6],
+ .feature_index = &adj_midchain_tx_no_count_feature_node[VNET_LINK_IP6],
};
VNET_MPLS_TX_FEATURE_INIT (adj_midchain_tx_mpls, static) = {
.node_name = "adj-midchain-txs",
.runs_before = ORDER_CONSTRAINTS {"interface-output"},
- .feature_index = &adj_midchain_tx_feature_node[FIB_LINK_MPLS],
+ .feature_index = &adj_midchain_tx_feature_node[VNET_LINK_MPLS],
};
VNET_MPLS_TX_FEATURE_INIT (adj_midchain_tx_no_count_mpls, static) = {
.node_name = "adj-midchain-tx-no-count",
.runs_before = ORDER_CONSTRAINTS {"interface-output"},
- .feature_index = &adj_midchain_tx_no_count_feature_node[FIB_LINK_MPLS],
+ .feature_index = &adj_midchain_tx_no_count_feature_node[VNET_LINK_MPLS],
};
VNET_ETHERNET_TX_FEATURE_INIT (adj_midchain_tx_ethernet, static) = {
.node_name = "adj-midchain-tx",
.runs_before = ORDER_CONSTRAINTS {"error-drop"},
- .feature_index = &adj_midchain_tx_feature_node[FIB_LINK_ETHERNET],
+ .feature_index = &adj_midchain_tx_feature_node[VNET_LINK_ETHERNET],
};
VNET_ETHERNET_TX_FEATURE_INIT (adj_midchain_tx_no_count_ethernet, static) = {
.node_name = "adj-midchain-tx-no-count",
.runs_before = ORDER_CONSTRAINTS {"error-drop"},
- .feature_index = &adj_midchain_tx_no_count_feature_node[FIB_LINK_ETHERNET],
+ .feature_index = &adj_midchain_tx_no_count_feature_node[VNET_LINK_ETHERNET],
};
static inline u32
-adj_get_midchain_node (fib_link_t link)
+adj_get_midchain_node (vnet_link_t link)
{
switch (link) {
- case FIB_LINK_IP4:
+ case VNET_LINK_IP4:
return (ip4_midchain_node.index);
- case FIB_LINK_IP6:
+ case VNET_LINK_IP6:
return (ip6_midchain_node.index);
- case FIB_LINK_MPLS:
+ case VNET_LINK_MPLS:
return (mpls_midchain_node.index);
- case FIB_LINK_ETHERNET:
+ case VNET_LINK_ETHERNET:
return (adj_l2_midchain_node.index);
+ case VNET_LINK_ARP:
+ break;
}
ASSERT(0);
return (0);
@@ -240,31 +242,34 @@ adj_midchain_get_cofing_for_link_type (const ip_adjacency_t *adj)
switch (adj->ia_link)
{
- case FIB_LINK_IP4:
+ case VNET_LINK_IP4:
{
ip4_main_t * im = &ip4_main;
ip_lookup_main_t * lm = &im->lookup_main;
cm = &lm->feature_config_mains[VNET_IP_TX_FEAT];
break;
}
- case FIB_LINK_IP6:
+ case VNET_LINK_IP6:
{
ip6_main_t * im = &ip6_main;
ip_lookup_main_t * lm = &im->lookup_main;
cm = &lm->feature_config_mains[VNET_IP_TX_FEAT];
break;
}
- case FIB_LINK_MPLS:
+ case VNET_LINK_MPLS:
{
mpls_main_t * mm = &mpls_main;
cm = &mm->feature_config_mains[VNET_IP_TX_FEAT];
break;
}
- case FIB_LINK_ETHERNET:
+ case VNET_LINK_ETHERNET:
{
cm = &ethernet_main.feature_config_mains[VNET_IP_TX_FEAT];
break;
}
+ case VNET_LINK_ARP:
+ ASSERT(0);
+ break;
}
return (cm);
@@ -351,7 +356,7 @@ adj_nbr_midchain_update_rewrite (adj_index_t adj_index,
*/
dpo_stack_from_node(adj->sub_type.midchain.tx_function_node,
&adj->sub_type.midchain.next_dpo,
- drop_dpo_get(fib_link_to_dpo_proto(adj->ia_link)));
+ drop_dpo_get(vnet_link_to_dpo_proto(adj->ia_link)));
/*
* update the rewirte with the workers paused.
@@ -390,9 +395,9 @@ adj_nbr_midchain_unstack (adj_index_t adj_index)
* stack on the drop
*/
dpo_stack(DPO_ADJACENCY_MIDCHAIN,
- fib_link_to_dpo_proto(adj->ia_link),
+ vnet_link_to_dpo_proto(adj->ia_link),
&adj->sub_type.midchain.next_dpo,
- drop_dpo_get(fib_link_to_dpo_proto(adj->ia_link)));
+ drop_dpo_get(vnet_link_to_dpo_proto(adj->ia_link)));
CLIB_MEMORY_BARRIER();
}
@@ -425,7 +430,7 @@ format_adj_midchain (u8* s, va_list *ap)
vnet_main_t * vnm = vnet_get_main();
ip_adjacency_t * adj = adj_get(index);
- s = format (s, "%U", format_fib_link, adj->ia_link);
+ s = format (s, "%U", format_vnet_link, adj->ia_link);
s = format (s, " via %U ",
format_ip46_address, &adj->sub_type.nbr.next_hop);
s = format (s, " %U",
diff --git a/vnet/vnet/adj/adj_nbr.c b/vnet/vnet/adj/adj_nbr.c
index 7bc5310ed7a..8d0511061de 100644
--- a/vnet/vnet/adj/adj_nbr.c
+++ b/vnet/vnet/adj/adj_nbr.c
@@ -43,7 +43,7 @@ static BVT(clib_bihash) **adj_nbr_tables[FIB_PROTOCOL_MAX];
static void
adj_nbr_insert (fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index,
adj_index_t adj_index)
@@ -77,7 +77,7 @@ adj_nbr_insert (fib_protocol_t nh_proto,
void
adj_nbr_remove (fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index)
{
@@ -93,7 +93,7 @@ adj_nbr_remove (fib_protocol_t nh_proto,
static adj_index_t
adj_nbr_find (fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index)
{
@@ -132,7 +132,7 @@ adj_get_nd_node (fib_protocol_t proto)
static ip_adjacency_t*
adj_nbr_alloc (fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index)
{
@@ -171,7 +171,7 @@ adj_nbr_alloc (fib_protocol_t nh_proto,
*/
adj_index_t
adj_nbr_add_or_lock (fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index)
{
@@ -211,7 +211,7 @@ adj_nbr_add_or_lock (fib_protocol_t nh_proto,
adj_index_t
adj_nbr_add_or_lock_w_rewrite (fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index,
u8 *rewrite)
@@ -289,7 +289,7 @@ adj_nbr_update_rewrite (adj_index_t adj_index,
* The link type MPLS Adj never has children. So if it is this adj
* that is updated, we need to walk from its IP sibling.
*/
- if (FIB_LINK_MPLS == adj->ia_link)
+ if (VNET_LINK_MPLS == adj->ia_link)
{
adj_index = adj_nbr_find(adj->ia_nh_proto,
fib_proto_to_link(adj->ia_nh_proto),
@@ -787,7 +787,7 @@ format_adj_nbr_incomplete (u8* s, va_list *ap)
vnet_main_t * vnm = vnet_get_main();
ip_adjacency_t * adj = adj_get(index);
- s = format (s, "arp-%U", format_fib_link, adj->ia_link);
+ s = format (s, "arp-%U", format_vnet_link, adj->ia_link);
s = format (s, ": via %U",
format_ip46_address, &adj->sub_type.nbr.next_hop,
adj_proto_to_46(adj->ia_nh_proto));
@@ -808,7 +808,7 @@ format_adj_nbr (u8* s, va_list *ap)
vnet_main_t * vnm = vnet_get_main();
ip_adjacency_t * adj = adj_get(index);
- s = format (s, "%U", format_fib_link, adj->ia_link);
+ s = format (s, "%U", format_vnet_link, adj->ia_link);
s = format (s, " via %U ",
format_ip46_address, &adj->sub_type.nbr.next_hop,
adj_proto_to_46(adj->ia_nh_proto));
diff --git a/vnet/vnet/adj/adj_nbr.h b/vnet/vnet/adj/adj_nbr.h
index 39663b603c6..293766b8519 100644
--- a/vnet/vnet/adj/adj_nbr.h
+++ b/vnet/vnet/adj/adj_nbr.h
@@ -45,7 +45,7 @@
* The interface on which the peer resides
*/
extern adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index);
@@ -71,7 +71,7 @@ extern adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto,
* The rewrite to prepend to packets
*/
extern adj_index_t adj_nbr_add_or_lock_w_rewrite(fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
const ip46_address_t *nh_addr,
u32 sw_if_index,
u8 *rewrite);
diff --git a/vnet/vnet/adj/adj_rewrite.c b/vnet/vnet/adj/adj_rewrite.c
index 046fff44731..7d792557724 100644
--- a/vnet/vnet/adj/adj_rewrite.c
+++ b/vnet/vnet/adj/adj_rewrite.c
@@ -23,7 +23,7 @@
*/
adj_index_t
adj_rewrite_add_and_lock (fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
u32 sw_if_index,
u8 *rewrite)
{
diff --git a/vnet/vnet/adj/adj_rewrite.h b/vnet/vnet/adj/adj_rewrite.h
index f8df255150d..25e6bba8868 100644
--- a/vnet/vnet/adj/adj_rewrite.h
+++ b/vnet/vnet/adj/adj_rewrite.h
@@ -42,7 +42,7 @@
* The rewrite to prepend to packets
*/
extern adj_index_t adj_rewrite_add_and_lock(fib_protocol_t nh_proto,
- fib_link_t link_type,
+ vnet_link_t link_type,
u32 sw_if_index,
u8 *rewrite);
diff --git a/vnet/vnet/fib/fib_entry_src.c b/vnet/vnet/fib/fib_entry_src.c
index 99ac09e7978..66bb3df2843 100644
--- a/vnet/vnet/fib/fib_entry_src.c
+++ b/vnet/vnet/fib/fib_entry_src.c
@@ -46,7 +46,7 @@ fib_entry_get_payload_proto (const fib_entry_t * fib_entry)
return fib_entry->fe_prefix.fp_payload_proto;
}
- return (fib_entry->fe_prefix.fp_proto);
+ return (fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto));
}
void
diff --git a/vnet/vnet/fib/fib_path.c b/vnet/vnet/fib/fib_path.c
index ba42e6be545..b67fedffe72 100644
--- a/vnet/vnet/fib/fib_path.c
+++ b/vnet/vnet/fib/fib_path.c
@@ -501,7 +501,7 @@ fib_path_last_lock_gone (fib_node_t *node)
static const adj_index_t
fib_path_attached_next_hop_get_adj (fib_path_t *path,
- fib_link_t link)
+ vnet_link_t link)
{
if (vnet_sw_interface_is_p2p(vnet_get_main(),
path->attached_next_hop.fp_interface))
diff --git a/vnet/vnet/fib/fib_test.c b/vnet/vnet/fib/fib_test.c
index bdd6e95f8d9..9b4179569a9 100644
--- a/vnet/vnet/fib/fib_test.c
+++ b/vnet/vnet/fib/fib_test.c
@@ -460,7 +460,7 @@ fib_test_v4 (void)
* find the adj in the shared db
*/
locked_ai = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&nh_10_10_10_1,
tm->hw[0]->sw_if_index);
FIB_TEST((locked_ai == ai), "ADJ NBR DB find");
@@ -564,7 +564,7 @@ fib_test_v4 (void)
"11.11.11.11/32 via incomplete adj");
ai_01 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&pfx_10_10_10_1_s_32.fp_addr,
tm->hw[0]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_01), "adj created");
@@ -594,7 +594,7 @@ fib_test_v4 (void)
"RPF list for adj-fib contains adj");
ai_12_12_12_12 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&nh_12_12_12_12,
tm->hw[1]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_12_12_12_12), "adj created");
@@ -641,7 +641,7 @@ fib_test_v4 (void)
eth_addr[5] = 0xb2;
ai_02 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&pfx_10_10_10_2_s_32.fp_addr,
tm->hw[0]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_02), "adj created");
@@ -1705,7 +1705,7 @@ fib_test_v4 (void)
fib_entry_pool_size());
ai_03 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&nh_10_10_10_3,
tm->hw[0]->sw_if_index);
@@ -2663,7 +2663,7 @@ fib_test_v4 (void)
ai = fib_entry_get_adj(fei);
ai2 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&pfx_4_1_1_1_s_32.fp_addr,
tm->hw[0]->sw_if_index);
FIB_TEST((ai == ai2), "Attached-host link to incomplete ADJ");
@@ -2718,7 +2718,7 @@ fib_test_v4 (void)
adj = adj_get(ai);
FIB_TEST((adj->lookup_next_index == IP_LOOKUP_NEXT_ARP),
"2001::/64 via ARP-adj");
- FIB_TEST((adj->ia_link == FIB_LINK_IP6),
+ FIB_TEST((adj->ia_link == VNET_LINK_IP6),
"2001::/64 is link type v6");
FIB_TEST((adj->ia_nh_proto == FIB_PROTOCOL_IP4),
"2001::/64 ADJ-adj is NH proto v4");
@@ -3043,7 +3043,7 @@ fib_test_v6 (void)
* find the adj in the shared db
*/
locked_ai = adj_nbr_add_or_lock(FIB_PROTOCOL_IP6,
- FIB_LINK_IP6,
+ VNET_LINK_IP6,
&nh_2001_2,
tm->hw[0]->sw_if_index);
FIB_TEST((locked_ai == ai), "ADJ NBR DB find");
@@ -3119,7 +3119,7 @@ fib_test_v6 (void)
};
ai_01 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP6,
- FIB_LINK_IP6,
+ VNET_LINK_IP6,
&pfx_2001_1_2_s_128.fp_addr,
tm->hw[0]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_01), "adj created");
@@ -3157,7 +3157,7 @@ fib_test_v6 (void)
eth_addr[5] = 0xb2;
ai_02 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP6,
- FIB_LINK_IP6,
+ VNET_LINK_IP6,
&pfx_2001_1_3_s_128.fp_addr,
tm->hw[0]->sw_if_index);
FIB_TEST((FIB_NODE_INDEX_INVALID != ai_02), "adj created");
@@ -3297,7 +3297,7 @@ fib_test_v6 (void)
adj = adj_get(ai);
FIB_TEST((adj->lookup_next_index == IP_LOOKUP_NEXT_ARP),
"1.1.1.1/32 via ARP-adj");
- FIB_TEST((adj->ia_link == FIB_LINK_IP4),
+ FIB_TEST((adj->ia_link == VNET_LINK_IP4),
"1.1.1.1/32 ADJ-adj is link type v4");
FIB_TEST((adj->ia_nh_proto == FIB_PROTOCOL_IP6),
"1.1.1.1/32 ADJ-adj is NH proto v6");
@@ -3955,7 +3955,7 @@ fib_test_gre (void)
/* vec_add(rewrite, &byte, 6); */
/* adjfib_ai1 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4, */
- /* FIB_LINK_IP4, */
+ /* VNET_LINK_IP4, */
/* &nh_10_10_10_2, */
/* tm->hw[0]->sw_if_index); */
/* adj_nbr_update_rewrite(FIB_PROTOCOL_IP4, */
@@ -3966,7 +3966,7 @@ fib_test_gre (void)
/* "Adj-fib10 adj is rewrite"); */
/* adjfib_ai2 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4, */
- /* FIB_LINK_IP4, */
+ /* VNET_LINK_IP4, */
/* &nh_10_10_11_2, */
/* tm->hw[1]->sw_if_index); */
/* adj_nbr_update_rewrite(FIB_PROTOCOL_IP4, */
@@ -5014,23 +5014,23 @@ fib_test_label (void)
};
ai_v4_10_10_11_1 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&nh_10_10_11_1,
tm->hw[1]->sw_if_index);
ai_v4_10_10_11_2 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&nh_10_10_11_2,
tm->hw[1]->sw_if_index);
ai_mpls_10_10_10_1 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_MPLS,
+ VNET_LINK_MPLS,
&nh_10_10_10_1,
tm->hw[0]->sw_if_index);
ai_mpls_10_10_11_2 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_MPLS,
+ VNET_LINK_MPLS,
&nh_10_10_11_2,
tm->hw[1]->sw_if_index);
ai_mpls_10_10_11_1 = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_MPLS,
+ VNET_LINK_MPLS,
&nh_10_10_11_1,
tm->hw[1]->sw_if_index);
diff --git a/vnet/vnet/fib/fib_types.c b/vnet/vnet/fib/fib_types.c
index f881a8f3ff2..f559ee52f2f 100644
--- a/vnet/vnet/fib/fib_types.c
+++ b/vnet/vnet/fib/fib_types.c
@@ -23,7 +23,7 @@
* arrays of protocol and link names
*/
static const char* fib_protocol_names[] = FIB_PROTOCOLS;
-static const char* fib_link_names[] = FIB_LINKS;
+static const char* vnet_link_names[] = VNET_LINKS;
static const char* fib_forw_chain_names[] = FIB_FORW_CHAINS;
u8 *
@@ -35,11 +35,11 @@ format_fib_protocol (u8 * s, va_list ap)
}
u8 *
-format_fib_link (u8 * s, va_list ap)
+format_vnet_link (u8 * s, va_list ap)
{
- fib_link_t link = va_arg(ap, int); // fib_link_t promotion
+ vnet_link_t link = va_arg(ap, int); // vnet_link_t promotion
- return (format (s, "%s", fib_link_names[link]));
+ return (format (s, "%s", vnet_link_names[link]));
}
u8 *
@@ -215,18 +215,20 @@ fib_proto_to_dpo (fib_protocol_t fib_proto)
}
dpo_proto_t
-fib_link_to_dpo_proto (fib_link_t linkt)
+vnet_link_to_dpo_proto (vnet_link_t linkt)
{
switch (linkt)
{
- case FIB_LINK_IP6:
+ case VNET_LINK_IP6:
return (DPO_PROTO_IP6);
- case FIB_LINK_IP4:
+ case VNET_LINK_IP4:
return (DPO_PROTO_IP4);
- case FIB_LINK_MPLS:
+ case VNET_LINK_MPLS:
return (DPO_PROTO_MPLS);
- case FIB_LINK_ETHERNET:
+ case VNET_LINK_ETHERNET:
return (DPO_PROTO_ETHERNET);
+ case VNET_LINK_ARP:
+ break;
}
ASSERT(0);
return (0);
@@ -250,17 +252,17 @@ dpo_proto_to_fib (dpo_proto_t dpo_proto)
return (0);
}
-fib_link_t
+vnet_link_t
fib_proto_to_link (fib_protocol_t proto)
{
switch (proto)
{
case FIB_PROTOCOL_IP4:
- return (FIB_LINK_IP4);
+ return (VNET_LINK_IP4);
case FIB_PROTOCOL_IP6:
- return (FIB_LINK_IP6);
+ return (VNET_LINK_IP6);
case FIB_PROTOCOL_MPLS:
- return (FIB_LINK_MPLS);
+ return (VNET_LINK_MPLS);
}
ASSERT(0);
return (0);
@@ -284,17 +286,17 @@ fib_forw_chain_type_from_dpo_proto (dpo_proto_t proto)
return (FIB_FORW_CHAIN_TYPE_UNICAST_IP4);
}
-fib_link_t
+vnet_link_t
fib_forw_chain_type_to_link_type (fib_forward_chain_type_t fct)
{
switch (fct)
{
case FIB_FORW_CHAIN_TYPE_UNICAST_IP4:
- return (FIB_LINK_IP4);
+ return (VNET_LINK_IP4);
case FIB_FORW_CHAIN_TYPE_UNICAST_IP6:
- return (FIB_LINK_IP6);
+ return (VNET_LINK_IP6);
case FIB_FORW_CHAIN_TYPE_ETHERNET:
- return (FIB_LINK_ETHERNET);
+ return (VNET_LINK_ETHERNET);
case FIB_FORW_CHAIN_TYPE_MPLS_EOS:
/*
* insufficient information to to convert
@@ -302,9 +304,9 @@ fib_forw_chain_type_to_link_type (fib_forward_chain_type_t fct)
ASSERT(0);
break;
case FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS:
- return (FIB_LINK_MPLS);
+ return (VNET_LINK_MPLS);
}
- return (FIB_LINK_IP4);
+ return (VNET_LINK_IP4);
}
dpo_proto_t
@@ -327,5 +329,5 @@ fib_forw_chain_type_to_dpo_proto (fib_forward_chain_type_t fct)
case FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS:
return (DPO_PROTO_MPLS);
}
- return (FIB_LINK_IP4);
+ return (VNET_LINK_IP4);
}
diff --git a/vnet/vnet/fib/fib_types.h b/vnet/vnet/fib/fib_types.h
index 2f23527ec1b..0bc17d6006c 100644
--- a/vnet/vnet/fib/fib_types.h
+++ b/vnet/vnet/fib/fib_types.h
@@ -68,44 +68,10 @@ typedef enum fib_protocol_t_ {
_item <= FIB_PROTOCOL_IP6; \
_item++)
-
-/**
- * Link Type. This maps directly into the ethertype.
- */
-typedef enum fib_link_t_ {
- FIB_LINK_IP4 = VNET_LINK_IP4,
- FIB_LINK_IP6 = VNET_LINK_IP6,
- FIB_LINK_MPLS = VNET_LINK_MPLS,
- FIB_LINK_ETHERNET = VNET_LINK_ETHERNET,
-} __attribute__ ((packed)) fib_link_t;
-
-/**
- * Definition outside of enum so it does not need to be included in non-defaulted
- * switch statements
- */
-#define FIB_LINK_NUM (FIB_LINK_ETHERNET+1)
-
-#define FIB_LINKS { \
- [FIB_LINK_ETHERNET] = "ethernet", \
- [FIB_LINK_IP4] = "ipv4", \
- [FIB_LINK_IP6] = "ipv6", \
- [FIB_LINK_MPLS] = "mpls", \
-}
-
-#define FOR_EACH_FIB_LINK(_item) \
- for (_item = FIB_LINK_IP4; \
- _item <= FIB_LINK_MPLS; \
- _item++)
-
-#define FOR_EACH_FIB_IP_LINK(_item) \
- for (_item = FIB_LINK_IP4; \
- _item <= FIB_LINK_IP6; \
- _item++)
-
/**
* @brief Convert from a protocol to a link type
*/
-fib_link_t fib_proto_to_link (fib_protocol_t proto);
+vnet_link_t fib_proto_to_link (fib_protocol_t proto);
/**
* FIB output chain type. When a child object requests a forwarding contribution
@@ -165,7 +131,7 @@ typedef enum fib_forward_chain_type_t_ {
/**
* @brief Convert from a chain type to the adjacencies link type
*/
-extern fib_link_t fib_forw_chain_type_to_link_type(fib_forward_chain_type_t fct);
+extern vnet_link_t fib_forw_chain_type_to_link_type(fib_forward_chain_type_t fct);
/**
* @brief Convert from a payload-protocol to a chain type.
@@ -244,7 +210,7 @@ extern u8 * format_fib_prefix(u8 * s, va_list * args);
extern u8 * format_fib_forw_chain_type(u8 * s, va_list * args);
extern dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto);
-extern dpo_proto_t fib_link_to_dpo_proto(fib_link_t linkt);
+extern dpo_proto_t vnet_link_to_dpo_proto(vnet_link_t linkt);
extern fib_protocol_t dpo_proto_to_fib(dpo_proto_t dpo_proto);
/**
@@ -279,7 +245,7 @@ typedef enum fib_special_type_t_ {
_item <= FIB_SPEICAL_TYPE_LAST; _item++)
extern u8 * format_fib_protocol(u8 * s, va_list ap);
-extern u8 * format_fib_link(u8 *s, va_list ap);
+extern u8 * format_vnet_link(u8 *s, va_list ap);
/**
* Path flags from the control plane
diff --git a/vnet/vnet/fib/fib_walk.c b/vnet/vnet/fib/fib_walk.c
index 1771047a6b4..078a65140db 100644
--- a/vnet/vnet/fib/fib_walk.c
+++ b/vnet/vnet/fib/fib_walk.c
@@ -248,7 +248,7 @@ fib_walk_destroy (fib_walk_t *fwalk)
* add the stats to the continuous histogram collection.
*/
bucket = (fwalk->fw_n_visits / HISTOGRAM_VISITS_PER_WALK_INCR);
- bucket = (bucket > HISTOGRAM_VISITS_PER_WALK_N_BUCKETS ?
+ bucket = (bucket >= HISTOGRAM_VISITS_PER_WALK_N_BUCKETS ?
HISTOGRAM_VISITS_PER_WALK_N_BUCKETS - 1 :
bucket);
fib_walk_hist_vists_per_walk[bucket]++;
diff --git a/vnet/vnet/gre/interface.c b/vnet/vnet/gre/interface.c
index 397a0427267..3234de09858 100644
--- a/vnet/vnet/gre/interface.c
+++ b/vnet/vnet/gre/interface.c
@@ -368,7 +368,7 @@ vnet_gre_tunnel_add (vnet_gre_add_del_tunnel_args_t *a,
if (t->teb)
{
t->l2_adj_index = adj_nbr_add_or_lock(FIB_PROTOCOL_IP4,
- FIB_LINK_ETHERNET,
+ VNET_LINK_ETHERNET,
&zero_addr,
sw_if_index);
diff --git a/vnet/vnet/interface.h b/vnet/vnet/interface.h
index c5a79472bba..1f5dcf1600a 100644
--- a/vnet/vnet/interface.h
+++ b/vnet/vnet/interface.h
@@ -216,6 +216,20 @@ typedef enum vnet_link_t_
VNET_LINK_ARP,
} __attribute__ ((packed)) vnet_link_t;
+#define VNET_LINKS { \
+ [VNET_LINK_ETHERNET] = "ethernet", \
+ [VNET_LINK_IP4] = "ipv4", \
+ [VNET_LINK_IP6] = "ipv6", \
+ [VNET_LINK_MPLS] = "mpls", \
+ [VNET_LINK_ARP] = "arp", \
+}
+
+/**
+ * @brief Number of link types. Not part of the enum so it does not have to be included in
+ * switch statements
+ */
+#define VNET_LINK_NUM (VNET_LINK_ARP+1)
+
/**
* @brief Convert a link to to an Ethertype
*/
diff --git a/vnet/vnet/ip/ip4_source_and_port_range_check.c b/vnet/vnet/ip/ip4_source_and_port_range_check.c
index 0c4d87c0ebc..677f610fd45 100644
--- a/vnet/vnet/ip/ip4_source_and_port_range_check.c
+++ b/vnet/vnet/ip/ip4_source_and_port_range_check.c
@@ -97,7 +97,6 @@ static inline u32
check_adj_port_range_x1 (const protocol_port_range_dpo_t * ppr_dpo,
u16 dst_port, u32 next)
{
- const protocol_port_range_t *range;
u16x8vec_t key;
u16x8vec_t diff1;
u16x8vec_t diff2;
@@ -140,7 +139,6 @@ check_adj_port_range_x1 (const protocol_port_range_dpo_t * ppr_dpo,
winner_mask = sum_nonzero & sum_equal;
if (winner_mask)
return next;
- range++;
}
return IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP;
}
diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c
index 5482a58be74..7a63a73c454 100644
--- a/vnet/vnet/ip/ip6_neighbor.c
+++ b/vnet/vnet/ip/ip6_neighbor.c
@@ -1910,7 +1910,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
{0x33, 0x33, 0x00, 0x00, 0x00, IP6_MULTICAST_GROUP_ID_all_hosts};
a->all_nodes_adj_index = adj_rewrite_add_and_lock(FIB_PROTOCOL_IP6,
- FIB_LINK_IP6,
+ VNET_LINK_IP6,
sw_if_index,
link_layer_address);
}
@@ -1920,7 +1920,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
{0x33, 0x33, 0x00, 0x00, 0x00, IP6_MULTICAST_GROUP_ID_all_routers};
a->all_routers_adj_index = adj_rewrite_add_and_lock(FIB_PROTOCOL_IP6,
- FIB_LINK_IP6,
+ VNET_LINK_IP6,
sw_if_index,
link_layer_address);
}
@@ -1931,7 +1931,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
a->all_mldv2_routers_adj_index =
adj_rewrite_add_and_lock(FIB_PROTOCOL_IP6,
- FIB_LINK_IP6,
+ VNET_LINK_IP6,
sw_if_index,
link_layer_address);
}
diff --git a/vnet/vnet/ip/lookup.h b/vnet/vnet/ip/lookup.h
index 84c4ffb2fd8..b73191cc4d8 100644
--- a/vnet/vnet/ip/lookup.h
+++ b/vnet/vnet/ip/lookup.h
@@ -196,7 +196,7 @@ typedef struct ip_adjacency_t_ {
/*
* link/ether-type
*/
- u8 ia_link;
+ vnet_link_t ia_link;
u8 ia_nh_proto;
union {
diff --git a/vnet/vnet/lisp-gpe/lisp_gpe_adjacency.c b/vnet/vnet/lisp-gpe/lisp_gpe_adjacency.c
index 37a8b089755..dadd09db96b 100644
--- a/vnet/vnet/lisp-gpe/lisp_gpe_adjacency.c
+++ b/vnet/vnet/lisp-gpe/lisp_gpe_adjacency.c
@@ -201,15 +201,15 @@ lisp_gpe_adj_stack (lisp_gpe_adjacency_t * ladj)
}
static lisp_gpe_next_protocol_e
-lisp_gpe_adj_proto_from_fib_link_type (fib_link_t linkt)
+lisp_gpe_adj_proto_from_vnet_link_type (vnet_link_t linkt)
{
switch (linkt)
{
- case FIB_LINK_IP4:
+ case VNET_LINK_IP4:
return (LISP_GPE_NEXT_PROTO_IP4);
- case FIB_LINK_IP6:
+ case VNET_LINK_IP6:
return (LISP_GPE_NEXT_PROTO_IP6);
- case FIB_LINK_ETHERNET:
+ case VNET_LINK_ETHERNET:
return (LISP_GPE_NEXT_PROTO_ETHERNET);
default:
ASSERT (0);
@@ -261,7 +261,7 @@ lisp_gpe_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
ADJ_MIDCHAIN_FLAG_NO_COUNT :
ADJ_MIDCHAIN_FLAG_NONE),
lisp_gpe_tunnel_build_rewrite
- (lgt, ladj, lisp_gpe_adj_proto_from_fib_link_type (linkt)));
+ (lgt, ladj, lisp_gpe_adj_proto_from_vnet_link_type (linkt)));
lisp_gpe_adj_stack_one (ladj, ai);
}
@@ -465,9 +465,6 @@ format_lisp_gpe_adjacency (u8 * s, va_list * args)
s = format (s, " %U\n",
format_lisp_gpe_tunnel,
lisp_gpe_tunnel_get (ladj->tunnel_index));
- /* s = format (s, " FIB adjacencies: IPV4:%d IPv6:%d L2:%d\n", */
- /* ladj->adjs[FIB_LINK_IP4], */
- /* ladj->adjs[FIB_LINK_IP6], ladj->adjs[FIB_LINK_ETHERNET]); */
}
else
{
diff --git a/vpp/app/vpe_cli.c b/vpp/app/vpe_cli.c
index 38bf843dd32..70fe3a77ff7 100644
--- a/vpp/app/vpe_cli.c
+++ b/vpp/app/vpe_cli.c
@@ -82,7 +82,7 @@ virtual_ip_cmd_fn_command_fn (vlib_main_t * vm,
fib_route_path_t *rpath;
adj_nbr_add_or_lock_w_rewrite (FIB_PROTOCOL_IP4,
- FIB_LINK_IP4,
+ VNET_LINK_IP4,
&next_hops[i],
sw_if_index, mac_addrs[i].mac_addr);
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index 33f87702056..cc067402d18 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -1046,7 +1046,6 @@ add_del_route_t_handler (u8 is_multipath,
u32 next_hop_weight, u32 next_hop_out_label)
{
vnet_classify_main_t *cm = &vnet_classify_main;
- fib_protocol_t proto = prefix->fp_proto;
stats_main_t *sm = &stats_main;
if (is_multipath)
@@ -1116,7 +1115,7 @@ add_del_route_t_handler (u8 is_multipath,
return VNET_API_ERROR_NO_SUCH_TABLE;
}
- dpo_set (&dpo, DPO_CLASSIFY, proto,
+ dpo_set (&dpo, DPO_CLASSIFY, dproto,
classify_dpo_create (prefix->fp_proto,
ntohl (classify_table_index)));
}