aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rwxr-xr-xsrc/vnet/ip/ip4_forward.c6
-rw-r--r--src/vnet/ip/ip6_forward.c4
-rw-r--r--src/vnet/ip/ip6_neighbor.c10
-rw-r--r--src/vnet/ip/ip_api.c38
-rwxr-xr-xsrc/vnet/ip/lookup.c18
5 files changed, 41 insertions, 35 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index ee17ea8804e..7a8d7a0cc1b 100755
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -724,7 +724,7 @@ ip4_add_interface_routes (u32 sw_if_index,
FIB_SOURCE_INTERFACE,
(FIB_ENTRY_FLAG_CONNECTED |
FIB_ENTRY_FLAG_ATTACHED),
- FIB_PROTOCOL_IP4,
+ DPO_PROTO_IP4,
/* No next-hop address */
NULL,
sw_if_index,
@@ -767,7 +767,7 @@ ip4_add_interface_routes (u32 sw_if_index,
fib_table_entry_update_one_path (fib_index, &net_pfx,
FIB_SOURCE_INTERFACE,
(FIB_ENTRY_FLAG_ATTACHED),
- FIB_PROTOCOL_IP4,
+ DPO_PROTO_IP4,
&net_pfx.fp_addr,
sw_if_index,
// invalid FIB index
@@ -803,7 +803,7 @@ ip4_add_interface_routes (u32 sw_if_index,
FIB_SOURCE_INTERFACE,
(FIB_ENTRY_FLAG_CONNECTED |
FIB_ENTRY_FLAG_LOCAL),
- FIB_PROTOCOL_IP4,
+ DPO_PROTO_IP4,
&pfx.fp_addr,
sw_if_index,
// invalid FIB index
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index bc66416e5ef..8ae08a01cf2 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -355,7 +355,7 @@ ip6_add_interface_routes (vnet_main_t * vnm, u32 sw_if_index,
FIB_SOURCE_INTERFACE,
(FIB_ENTRY_FLAG_CONNECTED |
FIB_ENTRY_FLAG_ATTACHED),
- FIB_PROTOCOL_IP6,
+ DPO_PROTO_IP6,
/* No next-hop address */
NULL, sw_if_index,
/* invalid FIB index */
@@ -390,7 +390,7 @@ ip6_add_interface_routes (vnet_main_t * vnm, u32 sw_if_index,
FIB_SOURCE_INTERFACE,
(FIB_ENTRY_FLAG_CONNECTED |
FIB_ENTRY_FLAG_LOCAL),
- FIB_PROTOCOL_IP6,
+ DPO_PROTO_IP6,
&pfx.fp_addr,
sw_if_index, ~0,
1, NULL, FIB_ROUTE_PATH_FLAG_NONE);
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index e8eebd4e869..6a9139ab2d2 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -284,7 +284,7 @@ ip6_neighbor_sw_interface_up_down (vnet_main_t * vnm,
(ip6_fib_table_get_index_for_sw_if_index (n->key.sw_if_index),
&pfx,
FIB_SOURCE_ADJ,
- FIB_PROTOCOL_IP6,
+ DPO_PROTO_IP6,
&pfx.fp_addr,
n->key.sw_if_index, ~0, 1, FIB_ROUTE_PATH_FLAG_NONE);
pool_put (nm->neighbor_pool, n);
@@ -645,7 +645,7 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm,
n->fib_entry_index =
fib_table_entry_path_add (fib_index, &pfx, FIB_SOURCE_ADJ,
FIB_ENTRY_FLAG_ATTACHED,
- FIB_PROTOCOL_IP6, &pfx.fp_addr,
+ DPO_PROTO_IP6, &pfx.fp_addr,
n->key.sw_if_index, ~0, 1, NULL,
FIB_ROUTE_PATH_FLAG_NONE);
}
@@ -776,7 +776,7 @@ vnet_unset_ip6_ethernet_neighbor (vlib_main_t * vm,
(ip6_fib_table_get_index_for_sw_if_index (n->key.sw_if_index),
&pfx,
FIB_SOURCE_ADJ,
- FIB_PROTOCOL_IP6,
+ DPO_PROTO_IP6,
&pfx.fp_addr, n->key.sw_if_index, ~0, 1, FIB_ROUTE_PATH_FLAG_NONE);
}
pool_put (nm->neighbor_pool, n);
@@ -4110,7 +4110,7 @@ ip6_neighbor_proxy_add_del (u32 sw_if_index, ip6_address_t * addr, u8 is_del)
fib_table_entry_path_remove (fib_index,
&pfx,
FIB_SOURCE_IP6_ND_PROXY,
- FIB_PROTOCOL_IP6,
+ DPO_PROTO_IP6,
&nh,
sw_if_index,
~0, 1, FIB_ROUTE_PATH_FLAG_NONE);
@@ -4124,7 +4124,7 @@ ip6_neighbor_proxy_add_del (u32 sw_if_index, ip6_address_t * addr, u8 is_del)
&pfx,
FIB_SOURCE_IP6_ND_PROXY,
FIB_ENTRY_FLAG_NONE,
- FIB_PROTOCOL_IP6,
+ DPO_PROTO_IP6,
&nh,
sw_if_index,
~0, 1, NULL, FIB_ROUTE_PATH_FLAG_NONE);
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 4cbf75a3883..0676a38704f 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -156,9 +156,9 @@ copy_fib_next_hop (fib_route_path_encode_t * api_rpath, void *fp_arg)
int is_ip4;
vl_api_fib_path_t *fp = (vl_api_fib_path_t *) fp_arg;
- if (api_rpath->rpath.frp_proto == FIB_PROTOCOL_IP4)
+ if (api_rpath->rpath.frp_proto == DPO_PROTO_IP4)
fp->afi = IP46_TYPE_IP4;
- else if (api_rpath->rpath.frp_proto == FIB_PROTOCOL_IP6)
+ else if (api_rpath->rpath.frp_proto == DPO_PROTO_IP6)
fp->afi = IP46_TYPE_IP6;
else
{
@@ -714,7 +714,7 @@ add_del_route_t_handler (u8 is_multipath,
u8 is_rpf_id,
u32 fib_index,
const fib_prefix_t * prefix,
- u8 next_hop_proto_is_ip4,
+ dpo_proto_t next_hop_proto,
const ip46_address_t * next_hop,
u32 next_hop_sw_if_index,
u8 next_hop_fib_index,
@@ -726,8 +726,7 @@ add_del_route_t_handler (u8 is_multipath,
vnet_classify_main_t *cm = &vnet_classify_main;
fib_route_path_flags_t path_flags = FIB_ROUTE_PATH_FLAG_NONE;
fib_route_path_t path = {
- .frp_proto = (next_hop_proto_is_ip4 ?
- FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6),
+ .frp_proto = next_hop_proto,
.frp_addr = (NULL == next_hop ? zero_addr : *next_hop),
.frp_sw_if_index = next_hop_sw_if_index,
.frp_fib_index = next_hop_fib_index,
@@ -740,7 +739,7 @@ add_del_route_t_handler (u8 is_multipath,
if (MPLS_LABEL_INVALID != next_hop_via_label)
{
- path.frp_proto = FIB_PROTOCOL_MPLS;
+ path.frp_proto = DPO_PROTO_MPLS;
path.frp_local_label = next_hop_via_label;
path.frp_eos = MPLS_NON_EOS;
}
@@ -855,7 +854,7 @@ int
add_del_route_check (fib_protocol_t table_proto,
u32 table_id,
u32 next_hop_sw_if_index,
- fib_protocol_t next_hop_table_proto,
+ dpo_proto_t next_hop_table_proto,
u32 next_hop_table_id,
u8 create_missing_tables,
u8 is_rpf_id, u32 * fib_index, u32 * next_hop_fib_index)
@@ -887,11 +886,18 @@ add_del_route_check (fib_protocol_t table_proto,
}
else
{
+ fib_protocol_t fib_nh_proto;
+
+ if (next_hop_table_proto > DPO_PROTO_MPLS)
+ return (0);
+
+ fib_nh_proto = dpo_proto_to_fib (next_hop_table_proto);
+
if (is_rpf_id)
- *next_hop_fib_index = mfib_table_find (next_hop_table_proto,
+ *next_hop_fib_index = mfib_table_find (fib_nh_proto,
ntohl (next_hop_table_id));
else
- *next_hop_fib_index = fib_table_find (next_hop_table_proto,
+ *next_hop_fib_index = fib_table_find (fib_nh_proto,
ntohl (next_hop_table_id));
if (~0 == *next_hop_fib_index)
@@ -900,12 +906,12 @@ add_del_route_check (fib_protocol_t table_proto,
{
if (is_rpf_id)
*next_hop_fib_index =
- mfib_table_find_or_create_and_lock (next_hop_table_proto,
+ mfib_table_find_or_create_and_lock (fib_nh_proto,
ntohl
(next_hop_table_id));
else
*next_hop_fib_index =
- fib_table_find_or_create_and_lock (next_hop_table_proto,
+ fib_table_find_or_create_and_lock (fib_nh_proto,
ntohl
(next_hop_table_id));
}
@@ -930,7 +936,7 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
rv = add_del_route_check (FIB_PROTOCOL_IP4,
mp->table_id,
mp->next_hop_sw_if_index,
- FIB_PROTOCOL_IP4,
+ DPO_PROTO_IP4,
mp->next_hop_table_id,
mp->create_vrf_if_needed, 0,
&fib_index, &next_hop_fib_index);
@@ -970,7 +976,7 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
mp->classify_table_index,
mp->is_resolve_host,
mp->is_resolve_attached, 0, 0,
- fib_index, &pfx, 1,
+ fib_index, &pfx, DPO_PROTO_IP4,
&nh,
ntohl (mp->next_hop_sw_if_index),
next_hop_fib_index,
@@ -990,7 +996,7 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
rv = add_del_route_check (FIB_PROTOCOL_IP6,
mp->table_id,
mp->next_hop_sw_if_index,
- FIB_PROTOCOL_IP6,
+ DPO_PROTO_IP6,
mp->next_hop_table_id,
mp->create_vrf_if_needed, 0,
&fib_index, &next_hop_fib_index);
@@ -1030,7 +1036,7 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
mp->classify_table_index,
mp->is_resolve_host,
mp->is_resolve_attached, 0, 0,
- fib_index, &pfx, 0,
+ fib_index, &pfx, DPO_PROTO_IP6,
&nh, ntohl (mp->next_hop_sw_if_index),
next_hop_fib_index,
mp->next_hop_weight,
@@ -1106,7 +1112,7 @@ mroute_add_del_handler (u8 is_add,
fib_route_path_t path = {
.frp_sw_if_index = next_hop_sw_if_index,
- .frp_proto = prefix->fp_proto,
+ .frp_proto = fib_proto_to_dpo (prefix->fp_proto),
};
if (is_local)
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index 533d010a738..41e46070267 100755
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -423,7 +423,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
{
rpath.frp_weight = 1;
rpath.frp_eos = MPLS_NON_EOS;
- rpath.frp_proto = FIB_PROTOCOL_MPLS;
+ rpath.frp_proto = DPO_PROTO_MPLS;
rpath.frp_sw_if_index = ~0;
vec_add1 (rpaths, rpath);
}
@@ -449,7 +449,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
&rpath.frp_sw_if_index))
{
rpath.frp_weight = 1;
- rpath.frp_proto = FIB_PROTOCOL_IP4;
+ rpath.frp_proto = DPO_PROTO_IP4;
vec_add1 (rpaths, rpath);
}
@@ -460,7 +460,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
&rpath.frp_sw_if_index))
{
rpath.frp_weight = 1;
- rpath.frp_proto = FIB_PROTOCOL_IP6;
+ rpath.frp_proto = DPO_PROTO_IP6;
vec_add1 (rpaths, rpath);
}
else if (unformat (line_input, "weight %u", &weight))
@@ -479,7 +479,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
{
rpath.frp_weight = 1;
rpath.frp_sw_if_index = ~0;
- rpath.frp_proto = FIB_PROTOCOL_IP4;
+ rpath.frp_proto = DPO_PROTO_IP4;
vec_add1 (rpaths, rpath);
}
else if (unformat (line_input, "via %U next-hop-table %d",
@@ -488,7 +488,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
{
rpath.frp_weight = 1;
rpath.frp_sw_if_index = ~0;
- rpath.frp_proto = FIB_PROTOCOL_IP6;
+ rpath.frp_proto = DPO_PROTO_IP6;
vec_add1 (rpaths, rpath);
}
else if (unformat (line_input, "via %U",
@@ -501,7 +501,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
rpath.frp_fib_index = table_id;
rpath.frp_weight = 1;
rpath.frp_sw_if_index = ~0;
- rpath.frp_proto = FIB_PROTOCOL_IP4;
+ rpath.frp_proto = DPO_PROTO_IP4;
vec_add1 (rpaths, rpath);
}
else if (unformat (line_input, "via %U",
@@ -510,13 +510,13 @@ vnet_ip_route_cmd (vlib_main_t * vm,
rpath.frp_fib_index = table_id;
rpath.frp_weight = 1;
rpath.frp_sw_if_index = ~0;
- rpath.frp_proto = FIB_PROTOCOL_IP6;
+ rpath.frp_proto = DPO_PROTO_IP6;
vec_add1 (rpaths, rpath);
}
else if (unformat (line_input,
"lookup in table %d", &rpath.frp_fib_index))
{
- rpath.frp_proto = pfx.fp_proto;
+ rpath.frp_proto = fib_proto_to_dpo (pfx.fp_proto);
rpath.frp_sw_if_index = ~0;
vec_add1 (rpaths, rpath);
}
@@ -526,7 +526,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
&rpath.frp_sw_if_index))
{
rpath.frp_weight = 1;
- rpath.frp_proto = prefixs[0].fp_proto;
+ rpath.frp_proto = fib_proto_to_dpo (prefixs[0].fp_proto);
vec_add1 (rpaths, rpath);
}
else if (vec_len (prefixs) > 0 &&