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>
This commit is contained in:
pcamaril
2020-02-04 08:36:51 +01:00
committed by Neale Ranns
parent 619179cfcd
commit 30e7671c85
12 changed files with 39 additions and 38 deletions

View File

@ -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;

View File

@ -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

View File

@ -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):

View File

@ -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))

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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++;

View File

@ -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)

View File

@ -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)
{

View File

@ -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))

View File

@ -128,7 +128,7 @@ index 03b80ec..06ef27f 100644
+ # +-+-+-+-+-+-+-+-+
+
+ name = "IPv6 Segment Routing Extension Header"
+ fields_desc = [ ByteEnumField("nh", 59, ipv6nh),
+ fields_desc = [ ByteEnumField("nh", 143, ipv6nh),
+ ByteField("len", None),
+ ByteField("type", 4),
+ ByteField("segleft", None),