summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-06-01 07:45:05 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-04-17 22:29:46 +0000
commite821ab100aea2fb3f740a98650eb750ff5911c49 (patch)
treee679732692ca211858ca64a3125a1e2a82104a7c /src/vnet/ip
parent167d458cba92e2f64f48fa7bc4430c770f290561 (diff)
IP mcast: allow unicast address as a next-hop
Change-Id: I5e679f2601e37688f2768620479dc2efb7d19ca3 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip.api1
-rw-r--r--src/vnet/ip/ip_api.c9
-rw-r--r--src/vnet/ip/lookup.c16
3 files changed, 25 insertions, 1 deletions
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api
index 38024926ab7..bf16c180d4d 100644
--- a/src/vnet/ip/ip.api
+++ b/src/vnet/ip/ip.api
@@ -446,6 +446,7 @@ autoreply define ip_mroute_add_del
u8 is_local;
u8 grp_address[16];
u8 src_address[16];
+ u8 nh_address[16];
};
/** \brief Dump IP multicast fib table
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 69ff719f3b9..b4d942b6bef 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -1208,13 +1208,15 @@ mroute_add_del_handler (u8 is_add,
dpo_proto_t nh_proto,
u32 entry_flags,
fib_rpf_id_t rpf_id,
- u32 next_hop_sw_if_index, u32 itf_flags, u32 bier_imp)
+ u32 next_hop_sw_if_index,
+ ip46_address_t * nh, u32 itf_flags, u32 bier_imp)
{
stats_dslock_with_hint (1 /* release hint */ , 2 /* tag */ );
fib_route_path_t path = {
.frp_sw_if_index = next_hop_sw_if_index,
.frp_proto = nh_proto,
+ .frp_addr = *nh,
};
if (is_local)
@@ -1253,6 +1255,7 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp)
{
fib_protocol_t fproto;
dpo_proto_t nh_proto;
+ ip46_address_t nh;
u32 fib_index;
int rv;
@@ -1277,6 +1280,8 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp)
sizeof (pfx.fp_grp_addr.ip4));
clib_memcpy (&pfx.fp_src_addr.ip4, mp->src_address,
sizeof (pfx.fp_src_addr.ip4));
+ memset (&nh.ip6, 0, sizeof (nh.ip6));
+ clib_memcpy (&nh.ip4, mp->nh_address, sizeof (nh.ip4));
}
else
{
@@ -1284,6 +1289,7 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp)
sizeof (pfx.fp_grp_addr.ip6));
clib_memcpy (&pfx.fp_src_addr.ip6, mp->src_address,
sizeof (pfx.fp_src_addr.ip6));
+ clib_memcpy (&nh.ip6, mp->nh_address, sizeof (nh.ip6));
}
return (mroute_add_del_handler (mp->is_add,
@@ -1293,6 +1299,7 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp)
ntohl (mp->entry_flags),
ntohl (mp->rpf_id),
ntohl (mp->next_hop_sw_if_index),
+ &nh,
ntohl (mp->itf_flags),
ntohl (mp->bier_imp)));
}
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index 216af4ce371..a26dc12889e 100644
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -899,14 +899,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",
+ unformat_ip4_address, &rpath.frp_addr.ip4,
+ unformat_vnet_sw_interface, vnm,
+ &rpath.frp_sw_if_index))
+ {
+ rpath.frp_weight = 1;
+ }
+ else if (unformat (line_input, "via %U %U",
+ unformat_ip6_address, &rpath.frp_addr.ip6,
+ unformat_vnet_sw_interface, vnm,
+ &rpath.frp_sw_if_index))
+ {
+ rpath.frp_weight = 1;
+ }
else if (unformat (line_input, "via %U",
unformat_vnet_sw_interface, vnm,
&rpath.frp_sw_if_index))
{
+ memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
rpath.frp_weight = 1;
}
else if (unformat (line_input, "via local"))
{
+ memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
rpath.frp_sw_if_index = ~0;
rpath.frp_weight = 1;
rpath.frp_flags |= FIB_ROUTE_PATH_LOCAL;