LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [net] seg6: fix SRv6 L2 tunnels to use IANA-assigned protocol number
@ 2020-03-11 16:54 Paolo Lungaroni
  2020-03-12  6:50 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Lungaroni @ 2020-03-11 16:54 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Alexey Kuznetsov,
	Hideaki YOSHIFUJI, netdev, linux-kernel
  Cc: Paolo Lungaroni, Andrea Mayer, Ahmed Abdelsalam

The Internet Assigned Numbers Authority (IANA) has recently assigned
a protocol number value of 143 for Ethernet [1].

Before this assignment, encapsulation mechanisms such as Segment Routing
used the IPv6-NoNxt protocol number (59) to indicate that the encapsulated
payload is an Ethernet frame.

In this patch, we add the definition of the Ethernet protocol number to the
kernel headers and update the SRv6 L2 tunnels to use it.

[1] https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

Signed-off-by: Paolo Lungaroni <paolo.lungaroni@cnit.it>
Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Acked-by: Ahmed Abdelsalam <ahmed.abdelsalam@gssi.it>
---
 include/uapi/linux/in.h  | 2 ++
 net/ipv6/seg6_iptunnel.c | 2 +-
 net/ipv6/seg6_local.c    | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index 1521073b6348..8533bf07450f 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -74,6 +74,8 @@ enum {
 #define IPPROTO_UDPLITE		IPPROTO_UDPLITE
   IPPROTO_MPLS = 137,		/* MPLS in IP (RFC 4023)		*/
 #define IPPROTO_MPLS		IPPROTO_MPLS
+  IPPROTO_ETHERNET = 143,	/* Ethernet-within-IPv6 Encapsulation	*/
+#define IPPROTO_ETHERNET	IPPROTO_ETHERNET
   IPPROTO_RAW = 255,		/* Raw IP packets			*/
 #define IPPROTO_RAW		IPPROTO_RAW
   IPPROTO_MPTCP = 262,		/* Multipath TCP connection		*/
diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index ab7f124ff5d7..8c52efe299cc 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -268,7 +268,7 @@ static int seg6_do_srh(struct sk_buff *skb)
 		skb_mac_header_rebuild(skb);
 		skb_push(skb, skb->mac_len);
 
-		err = seg6_do_srh_encap(skb, tinfo->srh, NEXTHDR_NONE);
+		err = seg6_do_srh_encap(skb, tinfo->srh, IPPROTO_ETHERNET);
 		if (err)
 			return err;
 
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 7cbc19731997..8165802d8e05 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -282,7 +282,7 @@ static int input_action_end_dx2(struct sk_buff *skb,
 	struct net_device *odev;
 	struct ethhdr *eth;
 
-	if (!decap_and_validate(skb, NEXTHDR_NONE))
+	if (!decap_and_validate(skb, IPPROTO_ETHERNET))
 		goto drop;
 
 	if (!pskb_may_pull(skb, ETH_HLEN))
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net] seg6: fix SRv6 L2 tunnels to use IANA-assigned protocol number
  2020-03-11 16:54 [net] seg6: fix SRv6 L2 tunnels to use IANA-assigned protocol number Paolo Lungaroni
@ 2020-03-12  6:50 ` David Miller
  2020-03-12 10:00   ` Ahmed Abdelsalam
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2020-03-12  6:50 UTC (permalink / raw)
  To: paolo.lungaroni
  Cc: kuba, kuznet, yoshfuji, netdev, linux-kernel, andrea.mayer,
	ahmed.abdelsalam

From: Paolo Lungaroni <paolo.lungaroni@cnit.it>
Date: Wed, 11 Mar 2020 17:54:06 +0100

> The Internet Assigned Numbers Authority (IANA) has recently assigned
> a protocol number value of 143 for Ethernet [1].
> 
> Before this assignment, encapsulation mechanisms such as Segment Routing
> used the IPv6-NoNxt protocol number (59) to indicate that the encapsulated
> payload is an Ethernet frame.
> 
> In this patch, we add the definition of the Ethernet protocol number to the
> kernel headers and update the SRv6 L2 tunnels to use it.
> 
> [1] https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
> 
> Signed-off-by: Paolo Lungaroni <paolo.lungaroni@cnit.it>
> Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> Acked-by: Ahmed Abdelsalam <ahmed.abdelsalam@gssi.it>

Applied.

But this is that classic case where we add a protocol element to the
tree before the official number is assigned.

Then the number is assigned and if we change it then everything using
the original number is no longer interoperable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net] seg6: fix SRv6 L2 tunnels to use IANA-assigned protocol number
  2020-03-12  6:50 ` David Miller
@ 2020-03-12 10:00   ` Ahmed Abdelsalam
  0 siblings, 0 replies; 3+ messages in thread
From: Ahmed Abdelsalam @ 2020-03-12 10:00 UTC (permalink / raw)
  To: David Miller, paolo.lungaroni
  Cc: kuba, kuznet, yoshfuji, netdev, linux-kernel, andrea.mayer

On 12/03/2020 07:50, David Miller wrote:
> But this is that classic case where we add a protocol element to the
> tree before the official number is assigned.
> 
> Then the number is assigned and if we change it then everything using
> the original number is no longer interoperable.

David, Is there a way to port this patch to previous releases ?
This would be really great and helpful.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-12 10:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 16:54 [net] seg6: fix SRv6 L2 tunnels to use IANA-assigned protocol number Paolo Lungaroni
2020-03-12  6:50 ` David Miller
2020-03-12 10:00   ` Ahmed Abdelsalam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).