Skip to content

Commit

Permalink
gre: set inner_protocol on xmit
Browse files Browse the repository at this point in the history
Ensure that the inner_protocol is set on transmit so that GSO segmentation,
which relies on that field, works correctly.

This is achieved by setting the inner_protocol in gre_build_header rather
than each caller of that function. It ensures that the inner_protocol is
set when gre_fb_xmit() is used to transmit GRE which was not previously the
case.

I have observed this is not the case when OvS transmits GRE using
lwtunnel metadata (which it always does).

Fixes: 3872035 ("gre: Use inner_proto to obtain inner header protocol")
Cc: Pravin Shelar <[email protected]>
Acked-by: Alexander Duyck <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
shorman-netronome authored and davem330 committed Aug 15, 2016
1 parent 5e45789 commit 3d7b332
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions include/net/gre.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ static inline void gre_build_header(struct sk_buff *skb, int hdr_len,

skb_push(skb, hdr_len);

skb_set_inner_protocol(skb, proto);
skb_reset_transport_header(skb);
greh = (struct gre_base_hdr *)skb->data;
greh->flags = gre_tnl_flags_to_gre_flags(flags);
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
tunnel->parms.o_flags, proto, tunnel->parms.o_key,
htonl(tunnel->o_seqno));

skb_set_inner_protocol(skb, proto);
ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol);
}

Expand Down
2 changes: 0 additions & 2 deletions net/ipv6/ip6_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,6 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags,
protocol, tunnel->parms.o_key, htonl(tunnel->o_seqno));

skb_set_inner_protocol(skb, protocol);

return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu,
NEXTHDR_GRE);
}
Expand Down

0 comments on commit 3d7b332

Please sign in to comment.