From 30e7671c85087b5781a34bde45ef3846f5de8c17 Mon Sep 17 00:00:00 2001 From: pcamaril Date: Tue, 4 Feb 2020 08:36:51 +0100 Subject: sr: update NH value for Ethernet payloads Upon encapsulation of L2 frames, IETF has replaced the NextHeader value from 59 (IPv6 No Next Header) to 143 (Ethernet). https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml Type: fix Signed-off-by: pcamaril Change-Id: I88aa5590c81d16700ff7a0bbe6337e113179496e Signed-off-by: pcamaril --- src/plugins/srv6-ad/node.c | 4 ++-- src/plugins/srv6-ad/test/test_srv6_ad.py | 2 +- src/plugins/srv6-am/test/test_srv6.py | 8 ++++---- src/plugins/srv6-as/as.c | 2 +- src/plugins/srv6-as/node.c | 4 ++-- src/plugins/srv6-as/test/test_srv6_as.py | 6 +++--- src/plugins/srv6-mobile/mobile.h | 4 ++-- src/plugins/srv6-mobile/node.c | 20 ++++++++++---------- 8 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/srv6-ad/node.c b/src/plugins/srv6-ad/node.c index dbd68cf4c98..9d4ea44e19b 100644 --- a/src/plugins/srv6-ad/node.c +++ b/src/plugins/srv6-ad/node.c @@ -156,7 +156,7 @@ end_ad_processing (vlib_buffer_t * b0, /* Make sure next header is valid */ if (PREDICT_FALSE (next_hdr != IP_PROTOCOL_IPV6 && next_hdr != IP_PROTOCOL_IP_IN_IP && - next_hdr != IP_PROTOCOL_IP6_NONXT)) + next_hdr != IP_PROTOCOL_IP6_ETHERNET)) { return; } @@ -175,7 +175,7 @@ end_ad_processing (vlib_buffer_t * b0, /* Remove IP header and extensions */ vlib_buffer_advance (b0, total_size); - if (next_hdr == IP_PROTOCOL_IP6_NONXT) + if (next_hdr == IP_PROTOCOL_IP6_ETHERNET) { /* Set output interface */ vnet_buffer (b0)->sw_if_index[VLIB_TX] = ls0_mem->sw_if_index_out; diff --git a/src/plugins/srv6-ad/test/test_srv6_ad.py b/src/plugins/srv6-ad/test/test_srv6_ad.py index 828cb74d0ea..2627df32aa9 100644 --- a/src/plugins/srv6-ad/test/test_srv6_ad.py +++ b/src/plugins/srv6-ad/test/test_srv6_ad.py @@ -718,7 +718,7 @@ class TestSRv6(VppTestCase): p = IPv6(src=srcaddr, dst=sidlist[segleft]) / \ IPv6ExtHdrSegmentRouting(addresses=sidlist, - segleft=segleft, nh=59) / \ + segleft=segleft, nh=143) / \ eth return p diff --git a/src/plugins/srv6-am/test/test_srv6.py b/src/plugins/srv6-am/test/test_srv6.py index d53147de3ff..5a4a936b0cb 100644 --- a/src/plugins/srv6-am/test/test_srv6.py +++ b/src/plugins/srv6-am/test/test_srv6.py @@ -1473,8 +1473,8 @@ class TestSRv6(VppTestCase): self.assertEqual(rx_srh.segleft, len(tx_seglist)-1) # segleft should be equal to lastentry self.assertEqual(rx_srh.segleft, rx_srh.lastentry) - # nh should be "No Next Header" (59) - self.assertEqual(rx_srh.nh, 59) + # nh should be "No Next Header" (143) + self.assertEqual(rx_srh.nh, 143) # the whole rx'ed pkt beyond SRH should be equal to tx'ed pkt self.assertEqual(Ether(scapy.compat.raw(rx_srh.payload)), tx_ether) @@ -2042,7 +2042,7 @@ class TestSRv6(VppTestCase): p = (IPv6(src='1234::1', dst=sidlist[segleft]) / IPv6ExtHdrSegmentRouting(addresses=sidlist, - segleft=segleft, nh=59) / + segleft=segleft, nh=143) / eth) return p @@ -2061,7 +2061,7 @@ class TestSRv6(VppTestCase): else: eth.type = etype - p = (IPv6(src='1234::1', dst=dst_outer, nh=59) / eth) + p = (IPv6(src='1234::1', dst=dst_outer, nh=143) / eth) return p def get_payload_info(self, packet): diff --git a/src/plugins/srv6-as/as.c b/src/plugins/srv6-as/as.c index cb95991cdda..1876765b8d6 100644 --- a/src/plugins/srv6-as/as.c +++ b/src/plugins/srv6-as/as.c @@ -182,7 +182,7 @@ srv6_as_localsid_creation_fn (ip6_sr_localsid_t * localsid) /* Prepare rewrite string */ ls_mem->rewrite = prepare_rewrite (ls_mem->src_addr, ls_mem->sid_list, - IP_PROTOCOL_IP6_NONXT); + IP_PROTOCOL_IP6_ETHERNET); /* Associate local SID index to this interface (resize vector if needed) */ if (ls_mem->sw_if_index_in >= vec_len (sm->sw_iface_localsid2)) diff --git a/src/plugins/srv6-as/node.c b/src/plugins/srv6-as/node.c index 6f424fcca12..9e84a9848e5 100644 --- a/src/plugins/srv6-as/node.c +++ b/src/plugins/srv6-as/node.c @@ -133,7 +133,7 @@ end_as_processing (vlib_buffer_t * b0, /* Make sure next header is valid */ if (PREDICT_FALSE (hdr_type != IP_PROTOCOL_IPV6 && hdr_type != IP_PROTOCOL_IP_IN_IP && - hdr_type != IP_PROTOCOL_IP6_NONXT)) + hdr_type != IP_PROTOCOL_IP6_ETHERNET)) { return; } @@ -141,7 +141,7 @@ end_as_processing (vlib_buffer_t * b0, /* Remove IP header and extensions */ vlib_buffer_advance (b0, encap_len); - if (hdr_type == IP_PROTOCOL_IP6_NONXT) + if (hdr_type == IP_PROTOCOL_IP6_ETHERNET) { /* Set output interface */ vnet_buffer (b0)->sw_if_index[VLIB_TX] = ls0_mem->sw_if_index_out; diff --git a/src/plugins/srv6-as/test/test_srv6_as.py b/src/plugins/srv6-as/test/test_srv6_as.py index 9e8e4252cc7..eec44e31ee5 100755 --- a/src/plugins/srv6-as/test/test_srv6_as.py +++ b/src/plugins/srv6-as/test/test_srv6_as.py @@ -523,8 +523,8 @@ class TestSRv6(VppTestCase): self.assertEqual(rx_srh.segleft, len(tx_seglist)-1) # segleft should be equal to lastentry self.assertEqual(rx_srh.segleft, rx_srh.lastentry) - # nh should be "No Next Header" (59) - self.assertEqual(rx_srh.nh, 59) + # nh should be "No Next Header" (143) + self.assertEqual(rx_srh.nh, 143) # get payload payload = rx_srh.payload else: @@ -796,7 +796,7 @@ class TestSRv6(VppTestCase): p = (IPv6(src='1234::1', dst=sidlist[segleft]) / IPv6ExtHdrSegmentRouting(addresses=sidlist, - segleft=segleft, nh=59) / + segleft=segleft, nh=143) / eth) return p diff --git a/src/plugins/srv6-mobile/mobile.h b/src/plugins/srv6-mobile/mobile.h index 5a086b66c6e..460cbe17ef1 100644 --- a/src/plugins/srv6-mobile/mobile.h +++ b/src/plugins/srv6-mobile/mobile.h @@ -33,8 +33,8 @@ #define SRV6_NHTYPE_IPV6 2 #define SRV6_NHTYPE_NON_IP 3 -#ifndef IP_PROTOCOL_NONE -#define IP_PROTOCOL_NONE 59 +#ifndef IP_PROTOCOL_IP6_ETHERNET +#define IP_PROTOCOL_IP6_ETHERNET 143 #endif #define SRV6_GTP6_UNKNOW 0 diff --git a/src/plugins/srv6-mobile/node.c b/src/plugins/srv6-mobile/node.c index 08357bb1b0e..efc92215cac 100644 --- a/src/plugins/srv6-mobile/node.c +++ b/src/plugins/srv6-mobile/node.c @@ -939,12 +939,12 @@ VLIB_NODE_FN (srv6_t_m_gtp4_d) (vlib_main_t * vm, } else if (ls_param->nhtype == SRV6_NHTYPE_NON_IP) { - ip6srv->sr.protocol = IP_PROTOCOL_NONE; + ip6srv->sr.protocol = IP_PROTOCOL_IP6_ETHERNET; } } else { - ip6srv->sr.protocol = IP_PROTOCOL_NONE; + ip6srv->sr.protocol = IP_PROTOCOL_IP6_ETHERNET; } } else @@ -958,7 +958,7 @@ VLIB_NODE_FN (srv6_t_m_gtp4_d) (vlib_main_t * vm, { ip6srv->ip.protocol = IP_PROTOCOL_IPV6_ROUTE; - ip6srv->sr.protocol = IP_PROTOCOL_NONE; + ip6srv->sr.protocol = IP_PROTOCOL_IP6_ETHERNET; ip6srv->sr.tag = clib_host_to_net_u16 (srh_tagfield[gtpu_type]); @@ -1008,7 +1008,7 @@ VLIB_NODE_FN (srv6_t_m_gtp4_d) (vlib_main_t * vm, } else if (ls_param->nhtype == SRV6_NHTYPE_NON_IP) { - ip6srv->ip.protocol = IP_PROTOCOL_NONE; + ip6srv->ip.protocol = IP_PROTOCOL_IP6_ETHERNET; } } } @@ -1680,12 +1680,12 @@ VLIB_NODE_FN (srv6_end_m_gtp6_d) (vlib_main_t * vm, } else if (ls_param->nhtype == SRV6_NHTYPE_NON_IP) { - ip6srv->sr.protocol = IP_PROTOCOL_NONE; + ip6srv->sr.protocol = IP_PROTOCOL_IP6_ETHERNET; } } else { - ip6srv->sr.protocol = IP_PROTOCOL_NONE; + ip6srv->sr.protocol = IP_PROTOCOL_IP6_ETHERNET; } } else @@ -1700,7 +1700,7 @@ VLIB_NODE_FN (srv6_end_m_gtp6_d) (vlib_main_t * vm, { ip6srv->ip.protocol = IP_PROTOCOL_IPV6_ROUTE; - ip6srv->sr.protocol = IP_PROTOCOL_NONE; + ip6srv->sr.protocol = IP_PROTOCOL_IP6_ETHERNET; ip6srv->sr.tag = clib_host_to_net_u16 (srh_tagfield[gtpu_type]); @@ -1748,7 +1748,7 @@ VLIB_NODE_FN (srv6_end_m_gtp6_d) (vlib_main_t * vm, } else if (ls_param->nhtype == SRV6_NHTYPE_NON_IP) { - ip6srv->ip.protocol = IP_PROTOCOL_NONE; + ip6srv->ip.protocol = IP_PROTOCOL_IP6_ETHERNET; } } } @@ -2152,12 +2152,12 @@ VLIB_NODE_FN (srv6_end_m_gtp6_d_di) (vlib_main_t * vm, } else if (ls_param->nhtype == SRV6_NHTYPE_NON_IP) { - ip6srv->sr.protocol = IP_PROTOCOL_NONE; + ip6srv->sr.protocol = IP_PROTOCOL_IP6_ETHERNET; } } else { - ip6srv->sr.protocol = IP_PROTOCOL_NONE; + ip6srv->sr.protocol = IP_PROTOCOL_IP6_ETHERNET; } good_n++; -- cgit 1.2.3-korg