aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorpcamaril <pcamaril@cisco.com>2020-02-04 08:36:51 +0100
committerNeale Ranns <nranns@cisco.com>2020-02-11 16:25:41 +0000
commit30e7671c85087b5781a34bde45ef3846f5de8c17 (patch)
tree532f76c9d61e8ed9a0967cd0bccaf552279f7dbe /src
parent619179cfcdb087acb0864d273c4fbd3b7396974c (diff)
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 <pcamaril@cisco.com> Change-Id: I88aa5590c81d16700ff7a0bbe6337e113179496e Signed-off-by: pcamaril <pcamaril@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/srv6-ad/node.c4
-rw-r--r--src/plugins/srv6-ad/test/test_srv6_ad.py2
-rw-r--r--src/plugins/srv6-am/test/test_srv6.py8
-rw-r--r--src/plugins/srv6-as/as.c2
-rw-r--r--src/plugins/srv6-as/node.c4
-rwxr-xr-xsrc/plugins/srv6-as/test/test_srv6_as.py6
-rw-r--r--src/plugins/srv6-mobile/mobile.h4
-rw-r--r--src/plugins/srv6-mobile/node.c20
-rw-r--r--src/vnet/ip/protocols.def3
-rwxr-xr-xsrc/vnet/srv6/sr_localsid.c2
-rwxr-xr-xsrc/vnet/srv6/sr_policy_rewrite.c20
11 files changed, 38 insertions, 37 deletions
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++;
diff --git a/src/vnet/ip/protocols.def b/src/vnet/ip/protocols.def
index e6c1f6379b0..ee92f563346 100644
--- a/src/vnet/ip/protocols.def
+++ b/src/vnet/ip/protocols.def
@@ -163,8 +163,9 @@ ip_protocol (139, HIP)
ip_protocol (140, SHIM6)
ip_protocol (141, WESP)
ip_protocol (142, ROHC)
+ip_protocol (143, IP6_ETHERNET)
-/* unassigned 143 - 252 */
+/* unassigned 144 - 252 */
ip_protocol (253, EXP1)
ip_protocol (254, EXP2)
diff --git a/src/vnet/srv6/sr_localsid.c b/src/vnet/srv6/sr_localsid.c
index 84306ad9fdf..7b71b2e71de 100755
--- a/src/vnet/srv6/sr_localsid.c
+++ b/src/vnet/srv6/sr_localsid.c
@@ -895,7 +895,7 @@ end_decaps_srh_processing (vlib_node_runtime_t * node,
return;
}
break;
- case IP_PROTOCOL_IP6_NONXT:
+ case IP_PROTOCOL_IP6_ETHERNET:
/* L2 encaps */
if (ls0->behavior == SR_BEHAVIOR_DX2)
{
diff --git a/src/vnet/srv6/sr_policy_rewrite.c b/src/vnet/srv6/sr_policy_rewrite.c
index 9c4d0ec493f..b7fbc4b8cda 100755
--- a/src/vnet/srv6/sr_policy_rewrite.c
+++ b/src/vnet/srv6/sr_policy_rewrite.c
@@ -1967,34 +1967,34 @@ sr_policy_rewrite_encaps_l2 (vlib_main_t * vm, vlib_node_runtime_t * node,
if (ip0->protocol == IP_PROTOCOL_IPV6_ROUTE)
{
sr0 = (void *) (ip0 + 1);
- sr0->protocol = IP_PROTOCOL_IP6_NONXT;
+ sr0->protocol = IP_PROTOCOL_IP6_ETHERNET;
}
else
- ip0->protocol = IP_PROTOCOL_IP6_NONXT;
+ ip0->protocol = IP_PROTOCOL_IP6_ETHERNET;
if (ip1->protocol == IP_PROTOCOL_IPV6_ROUTE)
{
sr1 = (void *) (ip1 + 1);
- sr1->protocol = IP_PROTOCOL_IP6_NONXT;
+ sr1->protocol = IP_PROTOCOL_IP6_ETHERNET;
}
else
- ip1->protocol = IP_PROTOCOL_IP6_NONXT;
+ ip1->protocol = IP_PROTOCOL_IP6_ETHERNET;
if (ip2->protocol == IP_PROTOCOL_IPV6_ROUTE)
{
sr2 = (void *) (ip2 + 1);
- sr2->protocol = IP_PROTOCOL_IP6_NONXT;
+ sr2->protocol = IP_PROTOCOL_IP6_ETHERNET;
}
else
- ip2->protocol = IP_PROTOCOL_IP6_NONXT;
+ ip2->protocol = IP_PROTOCOL_IP6_ETHERNET;
if (ip3->protocol == IP_PROTOCOL_IPV6_ROUTE)
{
sr3 = (void *) (ip3 + 1);
- sr3->protocol = IP_PROTOCOL_IP6_NONXT;
+ sr3->protocol = IP_PROTOCOL_IP6_ETHERNET;
}
else
- ip3->protocol = IP_PROTOCOL_IP6_NONXT;
+ ip3->protocol = IP_PROTOCOL_IP6_ETHERNET;
/* Which Traffic class and flow label do I set ? */
//ip0->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32(0|((6&0xF)<<28)|((ip0_encap->tos&0xFF)<<20));
@@ -2105,10 +2105,10 @@ sr_policy_rewrite_encaps_l2 (vlib_main_t * vm, vlib_node_runtime_t * node,
if (ip0->protocol == IP_PROTOCOL_IPV6_ROUTE)
{
sr0 = (void *) (ip0 + 1);
- sr0->protocol = IP_PROTOCOL_IP6_NONXT;
+ sr0->protocol = IP_PROTOCOL_IP6_ETHERNET;
}
else
- ip0->protocol = IP_PROTOCOL_IP6_NONXT;
+ ip0->protocol = IP_PROTOCOL_IP6_ETHERNET;
if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE) &&
PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))