sr: update NH value for Ethernet payloads 75/24775/4
authorpcamaril <pcamaril@cisco.com>
Tue, 4 Feb 2020 07:36:51 +0000 (08:36 +0100)
committerNeale Ranns <nranns@cisco.com>
Tue, 11 Feb 2020 16:25:41 +0000 (16:25 +0000)
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>
12 files changed:
src/plugins/srv6-ad/node.c
src/plugins/srv6-ad/test/test_srv6_ad.py
src/plugins/srv6-am/test/test_srv6.py
src/plugins/srv6-as/as.c
src/plugins/srv6-as/node.c
src/plugins/srv6-as/test/test_srv6_as.py
src/plugins/srv6-mobile/mobile.h
src/plugins/srv6-mobile/node.c
src/vnet/ip/protocols.def
src/vnet/srv6/sr_localsid.c
src/vnet/srv6/sr_policy_rewrite.c
test/patches/scapy-2.3.3/inet6.py.patch

index dbd68cf..9d4ea44 100644 (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;
index 828cb74..2627df3 100644 (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
 
index d53147d..5a4a936 100644 (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):
index cb95991..1876765 100644 (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))
index 6f424fc..9e84a98 100644 (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;
index 9e8e425..eec44e3 100755 (executable)
@@ -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
 
index 5a086b6..460cbe1 100644 (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
index 08357bb..efc9221 100644 (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++;
index e6c1f63..ee92f56 100644 (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)
index 84306ad..7b71b2e 100755 (executable)
@@ -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)
        {
index 9c4d0ec..b7fbc4b 100755 (executable)
@@ -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))
index 706e197..2bac37e 100644 (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),