aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2024-04-19 11:02:28 +0000
committerBeno�t Ganne <bganne@cisco.com>2024-06-03 12:29:37 +0000
commit8c77c1930abd36150edadcf523eceef7810e6487 (patch)
tree3721071a5c7c5d44e537c0e600eee26848756b17 /src/vnet
parent5f694322a925200d698db1025e721842e80d4b38 (diff)
ip: add support for drop route through vpp CLI
Type: improvement Change-Id: Ib822f36ff7b3ecda162fc99bf3892f912d0649f0 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/fib/fib_types.c4
-rw-r--r--src/vnet/ip/lookup.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/src/vnet/fib/fib_types.c b/src/vnet/fib/fib_types.c
index c4472c7122d..9abb89bc6a0 100644
--- a/src/vnet/fib/fib_types.c
+++ b/src/vnet/fib/fib_types.c
@@ -715,6 +715,10 @@ unformat_fib_route_path (unformat_input_t * input, va_list * args)
rpath->frp_proto = DPO_PROTO_IP6;
rpath->frp_flags = FIB_ROUTE_PATH_INTF_RX;
}
+ else if (unformat (input, "drop"))
+ {
+ rpath->frp_flags = FIB_ROUTE_PATH_DROP;
+ }
else if (unformat (input, "local"))
{
clib_memset (&rpath->frp_addr, 0, sizeof (rpath->frp_addr));
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index c225c222a38..c0fa430e0aa 100644
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -603,6 +603,8 @@ VLIB_CLI_COMMAND (vlib_cli_show_ip6_command, static) = {
* @cliexcmd{ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0 weight 3}
* To add a route to a particular FIB table (VRF), use:
* @cliexcmd{ip route add 172.16.24.0/24 table 7 via GigabitEthernet2/0/0}
+ * To add a route to drop the traffic:
+ * @cliexcmd{ip route add 172.16.24.0/24 table 100 via 127.0.0.1 drop}
?*/
VLIB_CLI_COMMAND (ip_route_command, static) = {
.path = "ip route",
@@ -612,7 +614,7 @@ VLIB_CLI_COMMAND (ip_route_command, static) = {
"<value>] [udp-encap <value>] [ip4-lookup-in-table <value>] "
"[ip6-lookup-in-table <value>] [mpls-lookup-in-table <value>] "
"[resolve-via-host] [resolve-via-connected] [rx-ip4|rx-ip6 "
- "<interface>] [out-labels <value value value>]",
+ "<interface>] [out-labels <value value value>] [drop]",
.function = vnet_ip_route_cmd,
.is_mp_safe = 1,
};