Skip to content

Commit ff827be

Browse files
peilin-yedavem330
authored andcommitted
ip_gre: Make o_seqno start from 0 in native mode
For GRE and GRETAP 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 gre_fb_xmit(), where tunnel->o_seqno is passed to gre_build_header() before getting incremented. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9810c58 commit ff827be

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

net/ipv4/ip_gre.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,12 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
459459
__be16 proto)
460460
{
461461
struct ip_tunnel *tunnel = netdev_priv(dev);
462-
463-
if (tunnel->parms.o_flags & TUNNEL_SEQ)
464-
tunnel->o_seqno++;
462+
__be16 flags = tunnel->parms.o_flags;
465463

466464
/* Push GRE header. */
467465
gre_build_header(skb, tunnel->tun_hlen,
468-
tunnel->parms.o_flags, proto, tunnel->parms.o_key,
469-
htonl(tunnel->o_seqno));
466+
flags, proto, tunnel->parms.o_key,
467+
(flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0);
470468

471469
ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol);
472470
}

0 commit comments

Comments
 (0)