Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
fib: fix crash while adding intf-rx routes
[vpp.git]
/
src
/
vnet
/
fib
/
fib_types.c
diff --git
a/src/vnet/fib/fib_types.c
b/src/vnet/fib/fib_types.c
index
15e795a
..
c4472c7
100644
(file)
--- a/
src/vnet/fib/fib_types.c
+++ b/
src/vnet/fib/fib_types.c
@@
-78,16
+78,15
@@
format_fib_mpls_label (u8 *s, va_list *ap)
}
void
}
void
-fib_prefix_from_ip46_addr (const ip46_address_t *addr,
+fib_prefix_from_ip46_addr (fib_protocol_t fproto,
+ const ip46_address_t *addr,
fib_prefix_t *pfx)
{
fib_prefix_t *pfx)
{
- ASSERT(
!ip46_address_is_zero(addr)
);
+ ASSERT(
FIB_PROTOCOL_MPLS != fproto
);
- pfx->fp_proto = ((ip46_address_is_ip4(addr) ?
- FIB_PROTOCOL_IP4 :
- FIB_PROTOCOL_IP6));
- pfx->fp_len = ((ip46_address_is_ip4(addr) ?
- 32 : 128));
+ pfx->fp_proto = fproto;
+ pfx->fp_len = ((FIB_PROTOCOL_IP4 == fproto) ?
+ 32 : 128);
pfx->fp_addr = *addr;
pfx->___fp___pad = 0;
}
pfx->fp_addr = *addr;
pfx->___fp___pad = 0;
}
@@
-541,6
+540,7
@@
unformat_fib_route_path (unformat_input_t * input, va_list * args)
{
fib_route_path_t *rpath = va_arg (*args, fib_route_path_t *);
dpo_proto_t *payload_proto = va_arg (*args, void*);
{
fib_route_path_t *rpath = va_arg (*args, fib_route_path_t *);
dpo_proto_t *payload_proto = va_arg (*args, void*);
+ dpo_proto_t explicit_proto = DPO_PROTO_NONE;
u32 weight, preference, udp_encap_id, fi;
mpls_label_t out_label;
vnet_main_t *vnm;
u32 weight, preference, udp_encap_id, fi;
mpls_label_t out_label;
vnet_main_t *vnm;
@@
-708,6
+708,13
@@
unformat_fib_route_path (unformat_input_t * input, va_list * args)
rpath->frp_proto = DPO_PROTO_IP4;
rpath->frp_flags = FIB_ROUTE_PATH_INTF_RX;
}
rpath->frp_proto = DPO_PROTO_IP4;
rpath->frp_flags = FIB_ROUTE_PATH_INTF_RX;
}
+ else if (unformat (input, "rx-ip6 %U",
+ unformat_vnet_sw_interface, vnm,
+ &rpath->frp_sw_if_index))
+ {
+ rpath->frp_proto = DPO_PROTO_IP6;
+ rpath->frp_flags = FIB_ROUTE_PATH_INTF_RX;
+ }
else if (unformat (input, "local"))
{
clib_memset (&rpath->frp_addr, 0, sizeof (rpath->frp_addr));
else if (unformat (input, "local"))
{
clib_memset (&rpath->frp_addr, 0, sizeof (rpath->frp_addr));
@@
-726,6
+733,14
@@
unformat_fib_route_path (unformat_input_t * input, va_list * args)
vec_add1(rpath->frp_label_stack, fml);
}
}
vec_add1(rpath->frp_label_stack, fml);
}
}
+ else if (unformat (input, "ip4"))
+ {
+ explicit_proto = DPO_PROTO_IP4;
+ }
+ else if (unformat (input, "ip6"))
+ {
+ explicit_proto = DPO_PROTO_IP6;
+ }
else if (unformat (input, "%U",
unformat_vnet_sw_interface, vnm,
&rpath->frp_sw_if_index))
else if (unformat (input, "%U",
unformat_vnet_sw_interface, vnm,
&rpath->frp_sw_if_index))
@@
-750,6
+765,9
@@
unformat_fib_route_path (unformat_input_t * input, va_list * args)
}
}
}
}
+ if (DPO_PROTO_NONE != explicit_proto)
+ *payload_proto = rpath->frp_proto = explicit_proto;
+
return (1);
}
return (1);
}
@@
-764,6
+782,7
@@
fib_route_path_is_attached (const fib_route_path_t *rpath)
* L3 game with these
*/
if (rpath->frp_flags & (FIB_ROUTE_PATH_DVR |
* L3 game with these
*/
if (rpath->frp_flags & (FIB_ROUTE_PATH_DVR |
+ FIB_ROUTE_PATH_INTF_RX |
FIB_ROUTE_PATH_UDP_ENCAP))
{
return (0);
FIB_ROUTE_PATH_UDP_ENCAP))
{
return (0);