aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/dpo/lookup_dpo.c24
-rw-r--r--test/test_mpls.py77
-rw-r--r--test/vpp_ip_route.py9
3 files changed, 101 insertions, 9 deletions
diff --git a/src/vnet/dpo/lookup_dpo.c b/src/vnet/dpo/lookup_dpo.c
index e5b00a79e52..cf489d7eb35 100644
--- a/src/vnet/dpo/lookup_dpo.c
+++ b/src/vnet/dpo/lookup_dpo.c
@@ -1206,7 +1206,7 @@ lookup_dpo_ip_dst_mcast_inline (vlib_main_t * vm,
vnet_buffer (b0)->ip.adj_index[VLIB_TX] = mfei0;
- vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next,
+ vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next,
n_left_to_next, bi0, next0);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
@@ -1236,6 +1236,28 @@ VLIB_REGISTER_NODE (lookup_ip4_dst_mcast_node) = {
VLIB_NODE_FUNCTION_MULTIARCH (lookup_ip4_dst_mcast_node,
lookup_ip4_dst_mcast)
+always_inline uword
+lookup_ip6_dst_mcast (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * from_frame)
+{
+ return (lookup_dpo_ip_dst_mcast_inline(vm, node, from_frame, 0));
+}
+
+VLIB_REGISTER_NODE (lookup_ip6_dst_mcast_node) = {
+ .function = lookup_ip6_dst_mcast,
+ .name = "lookup-ip6-dst-mcast",
+ .vector_size = sizeof (u32),
+
+ .format_trace = format_lookup_trace,
+ .n_next_nodes = LOOKUP_IP_DST_MCAST_N_NEXT,
+ .next_nodes = {
+ [LOOKUP_IP_DST_MCAST_NEXT_RPF] = "ip6-mfib-forward-rpf",
+ },
+};
+VLIB_NODE_FUNCTION_MULTIARCH (lookup_ip6_dst_mcast_node,
+ lookup_ip6_dst_mcast)
+
static void
lookup_dpo_mem_show (void)
{
diff --git a/test/test_mpls.py b/test/test_mpls.py
index d0c9e249a05..77cec429f5a 100644
--- a/test/test_mpls.py
+++ b/test/test_mpls.py
@@ -102,7 +102,10 @@ class TestMPLS(VppTestCase):
pkts.append(p)
return pkts
- def create_stream_labelled_ip6(self, src_if, mpls_label, mpls_ttl):
+ def create_stream_labelled_ip6(self, src_if, mpls_label, mpls_ttl,
+ dst_ip=None):
+ if dst_ip is None:
+ dst_ip = src_if.remote_ip6
self.reset_packet_infos()
pkts = []
for i in range(0, 257):
@@ -110,7 +113,7 @@ class TestMPLS(VppTestCase):
payload = self.info_to_payload(info)
p = (Ether(dst=src_if.local_mac, src=src_if.remote_mac) /
MPLS(label=mpls_label, ttl=mpls_ttl) /
- IPv6(src=src_if.remote_ip6, dst=src_if.remote_ip6) /
+ IPv6(src=src_if.remote_ip6, dst=dst_ip) /
UDP(sport=1234, dport=1234) /
Raw(payload))
info.data = p.copy()
@@ -928,8 +931,8 @@ class TestMPLS(VppTestCase):
rx = self.pg3.get_capture(257)
self.verify_capture_tunneled_ip4(self.pg0, rx, tx, [43])
- def test_mcast_tail(self):
- """ MPLS Multicast Tail """
+ def test_mcast_ip4_tail(self):
+ """ MPLS IPv4 Multicast Tail """
#
# Add a multicast route that will forward the traffic
@@ -994,6 +997,72 @@ class TestMPLS(VppTestCase):
dst_ip="232.1.1.1")
self.send_and_assert_no_replies(self.pg0, tx, "RPF-ID drop 56")
+ def test_mcast_ip6_tail(self):
+ """ MPLS IPv6 Multicast Tail """
+
+ #
+ # Add a multicast route that will forward the traffic
+ # post-disposition
+ #
+ route_ff = VppIpMRoute(
+ self,
+ "::",
+ "ff01::1", 32,
+ MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
+ table_id=1,
+ paths=[VppMRoutePath(self.pg1.sw_if_index,
+ MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)],
+ is_ip6=1)
+ route_ff.add_vpp_config()
+
+ #
+ # An interface receive label that maps traffic to RX on interface
+ # pg1
+ # by injecting the packet in on pg0, which is in table 0
+ # doing an rpf-id and matching a route in table 1
+ # if the packet egresses, then we must have matched the route in
+ # table 1
+ #
+ route_34_eos = VppMplsRoute(
+ self, 34, 1,
+ [VppRoutePath("::",
+ self.pg1.sw_if_index,
+ nh_table_id=1,
+ rpf_id=55,
+ is_ip6=1)],
+ is_multicast=1)
+
+ route_34_eos.add_vpp_config()
+
+ #
+ # Drop due to interface lookup miss
+ #
+ tx = self.create_stream_labelled_ip6(self.pg0, [34], 255,
+ dst_ip="ff01::1")
+
+ #
+ # set the RPF-ID of the enrtry to match the input packet's
+ #
+ route_ff.update_rpf_id(55)
+
+ tx = self.create_stream_labelled_ip6(self.pg0, [34], 255,
+ dst_ip="ff01::1")
+ self.pg0.add_stream(tx)
+
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+
+ rx = self.pg1.get_capture(257)
+ self.verify_capture_ip6(self.pg1, rx, tx)
+
+ #
+ # set the RPF-ID of the enrtry to not match the input packet's
+ #
+ route_ff.update_rpf_id(56)
+ tx = self.create_stream_labelled_ip6(self.pg0, [34], 225,
+ dst_ip="ff01::1")
+ self.send_and_assert_no_replies(self.pg0, tx, "RPF-ID drop 56")
+
class TestMPLSDisabled(VppTestCase):
""" MPLS disabled """
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index b68e2105548..badb3102752 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -66,10 +66,11 @@ class VppRoutePath(object):
self.nh_labels = labels
self.weight = 1
self.rpf_id = rpf_id
- if is_ip6:
- self.nh_addr = inet_pton(AF_INET6, nh_addr)
- else:
+ self.is_ip4 = 1 if is_ip6 == 0 else 0
+ if self.is_ip4:
self.nh_addr = inet_pton(AF_INET, nh_addr)
+ else:
+ self.nh_addr = inet_pton(AF_INET6, nh_addr)
self.is_resolve_host = is_resolve_host
self.is_resolve_attached = is_resolve_attached
self.is_interface_rx = is_interface_rx
@@ -400,7 +401,7 @@ class VppMplsRoute(VppObject):
self._test.vapi.mpls_route_add_del(
self.local_label,
self.eos_bit,
- 1,
+ path.is_ip4,
path.nh_addr,
path.nh_itf,
is_multicast=self.is_multicast,