summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-12-05 16:39:45 +0000
committerNeale Ranns <nranns@cisco.com>2018-12-06 13:49:59 +0000
commitad69c1fddc4f3d1054cb527e550dfa1698355244 (patch)
tree371cdc81eb05ce6389ceb63815865a60c17184a1 /src
parent027d0dc75690e75c01673f3830c782d6a4eca998 (diff)
MFIB; CLI improvements
Change-Id: I7cf3ae8c10dd584e8bc234a3253bea3c5a2d105a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/lookup.c38
-rw-r--r--src/vnet/mfib/mfib_types.c6
2 files changed, 37 insertions, 7 deletions
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index 9986a709fef..2a9b3fed0c9 100644
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -814,6 +814,7 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
mfib_entry_flags_t eflags = 0;
u32 gcount, scount, ss, gg, incr;
f64 timet[2];
+ u32 rpf_id = MFIB_RPF_ID_NONE;
gcount = scount = 1;
vnm = vnet_get_main ();
@@ -835,6 +836,8 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
is_del = 1;
else if (unformat (line_input, "add"))
is_del = 0;
+ else if (unformat (line_input, "rpf-id %d", &rpf_id))
+ ;
else if (unformat (line_input, "scount %d", &scount))
;
else if (unformat (line_input, "gcount %d", &gcount))
@@ -883,6 +886,30 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
pfx.fp_proto = FIB_PROTOCOL_IP6;
pfx.fp_len = 128;
}
+ else if (unformat (line_input, "via %U %U %U",
+ unformat_ip4_address, &rpath.frp_addr.ip4,
+ unformat_vnet_sw_interface, vnm,
+ &rpath.frp_sw_if_index,
+ unformat_mfib_itf_flags, &iflags))
+ {
+ rpath.frp_weight = 1;
+ }
+ else if (unformat (line_input, "via %U %U %U",
+ unformat_ip6_address, &rpath.frp_addr.ip6,
+ unformat_vnet_sw_interface, vnm,
+ &rpath.frp_sw_if_index,
+ unformat_mfib_itf_flags, &iflags))
+ {
+ rpath.frp_weight = 1;
+ }
+ else if (unformat (line_input, "via %U %U",
+ unformat_vnet_sw_interface, vnm,
+ &rpath.frp_sw_if_index,
+ unformat_mfib_itf_flags, &iflags))
+ {
+ clib_memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
+ rpath.frp_weight = 1;
+ }
else if (unformat (line_input, "via %U %U",
unformat_ip4_address, &rpath.frp_addr.ip4,
unformat_vnet_sw_interface, vnm,
@@ -904,7 +931,7 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
clib_memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
rpath.frp_weight = 1;
}
- else if (unformat (line_input, "via local"))
+ else if (unformat (line_input, "via local Forward"))
{
clib_memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
rpath.frp_sw_if_index = ~0;
@@ -914,9 +941,8 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
* set the path proto appropriately for the prefix
*/
rpath.frp_proto = fib_proto_to_dpo (pfx.fp_proto);
+ iflags = MFIB_ITF_FLAG_FORWARD;
}
- else if (unformat (line_input, "%U", unformat_mfib_itf_flags, &iflags))
- ;
else if (unformat (line_input, "%U",
unformat_mfib_entry_flags, &eflags))
;
@@ -965,10 +991,10 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
/* no path provided => route delete */
mfib_table_entry_delete (fib_index, &pfx, MFIB_SOURCE_CLI);
}
- else if (eflags)
+ else if (eflags || (MFIB_RPF_ID_NONE != rpf_id))
{
mfib_table_entry_update (fib_index, &pfx, MFIB_SOURCE_CLI,
- MFIB_RPF_ID_NONE, eflags);
+ rpf_id, eflags);
}
else
{
@@ -1053,7 +1079,7 @@ done:
VLIB_CLI_COMMAND (ip_mroute_command, static) =
{
.path = "ip mroute",
- .short_help = "ip mroute [add|del] <dst-ip-addr>/<width> [table <table-id>] [via <next-hop-ip-addr> [<interface>],",
+ .short_help = "ip mroute [add|del] <dst-ip-addr>/<width> [table <table-id>] [rpf-id <ID>] [via <next-hop-ip-addr> [<interface>],",
.function = vnet_ip_mroute_cmd,
.is_mp_safe = 1,
};
diff --git a/src/vnet/mfib/mfib_types.c b/src/vnet/mfib/mfib_types.c
index 8452d86f6c6..a3ed46a4b8d 100644
--- a/src/vnet/mfib/mfib_types.c
+++ b/src/vnet/mfib/mfib_types.c
@@ -93,7 +93,7 @@ format_mfib_entry_flags (u8 * s, va_list * args)
s = format(s, " flags:");
FOR_EACH_MFIB_ATTRIBUTE(attr) {
if ((1<<attr) & flags) {
- s = format (s, "%s,", mfib_flag_names[attr]);
+ s = format (s, "%s,", mfib_flag_names_long[attr]);
}
}
}
@@ -147,6 +147,10 @@ unformat_mfib_entry_flags (unformat_input_t * input,
old = *eflags;
FOR_EACH_MFIB_ATTRIBUTE(attr) {
+ if (unformat (input, mfib_flag_names_long[attr]))
+ *eflags |= (1 << attr);
+ }
+ FOR_EACH_MFIB_ATTRIBUTE(attr) {
if (unformat (input, mfib_flag_names[attr]))
*eflags |= (1 << attr);
}