Patch "ip6_gre: Make o_seqno start from 0 in native mode" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ip6_gre: Make o_seqno start from 0 in native mode

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ip6_gre-make-o_seqno-start-from-0-in-native-mode.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3246d91e01c1ce08d4ee55dae6ca9a536dbdf1af
Author: Peilin Ye <peilin.ye@xxxxxxxxxxxxx>
Date:   Thu Apr 21 15:08:38 2022 -0700

    ip6_gre: Make o_seqno start from 0 in native mode
    
    [ Upstream commit fde98ae91f79cab4e020f40c35ed23cbdc59661c ]
    
    For IP6GRE and IP6GRETAP devices, currently o_seqno starts from 1 in
    native mode.  According to RFC 2890 2.2., "The first datagram is sent
    with a sequence number of 0."  Fix it.
    
    It is worth mentioning that o_seqno already starts from 0 in collect_md
    mode, see the "if (tunnel->parms.collect_md)" clause in __gre6_xmit(),
    where tunnel->o_seqno is passed to gre_build_header() before getting
    incremented.
    
    Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
    Signed-off-by: Peilin Ye <peilin.ye@xxxxxxxxxxxxx>
    Acked-by: William Tu <u9012063@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Stable-dep-of: d80fc101d2eb ("erspan: get the proto with the md version for collect_md")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index a1fd3c9c1da3e..e3c65e7681ad4 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -711,6 +711,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
 {
 	struct ip6_tnl *tunnel = netdev_priv(dev);
 	__be16 protocol;
+	__be16 flags;
 
 	if (dev->type == ARPHRD_ETHER)
 		IPCB(skb)->flags = 0;
@@ -726,7 +727,6 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
 	if (tunnel->parms.collect_md) {
 		struct ip_tunnel_info *tun_info;
 		const struct ip_tunnel_key *key;
-		__be16 flags;
 		int tun_hlen;
 
 		tun_info = skb_tunnel_info(skb);
@@ -758,15 +758,14 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
 						      : 0);
 
 	} else {
-		if (tunnel->parms.o_flags & TUNNEL_SEQ)
-			tunnel->o_seqno++;
-
 		if (skb_cow_head(skb, dev->needed_headroom ?: tunnel->hlen))
 			return -ENOMEM;
 
-		gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags,
+		flags = tunnel->parms.o_flags;
+
+		gre_build_header(skb, tunnel->tun_hlen, flags,
 				 protocol, tunnel->parms.o_key,
-				 htonl(tunnel->o_seqno));
+				 (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0);
 	}
 
 	return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu,



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux