Skip to content

Commit

Permalink
gre: fix the inner mac header in nbma tunnel xmit path
Browse files Browse the repository at this point in the history
The NBMA GRE tunnels temporarily push GRE header that contain the
per-packet NBMA destination on the skb via header ops early in xmit
path. It is the later pulled before the real GRE header is constructed.

The inner mac was thus set differently in nbma case: the GRE header
has been pushed by neighbor layer, and mac header points to beginning
of the temporary gre header (set by dev_queue_xmit).

Now that the offloads expect mac header to point to the gre payload,
fix the xmit patch to:
 - pull first the temporary gre header away
 - and reset mac header to point to gre payload

This fixes tso to work again with nbma tunnels.

Fixes: 14051f0 ("gre: Use inner mac length when computing tunnel length")
Signed-off-by: Timo Teräs <[email protected]>
Cc: Tom Herbert <[email protected]>
Cc: Alexander Duyck <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
fabled authored and davem330 committed Dec 15, 2014
1 parent fd22306 commit 8a0033a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
struct ip_tunnel *tunnel = netdev_priv(dev);
const struct iphdr *tnl_params;

skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM));
if (IS_ERR(skb))
goto out;

if (dev->header_ops) {
/* Need space for new headers */
if (skb_cow_head(skb, dev->needed_headroom -
Expand All @@ -268,13 +264,18 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
* to gre header.
*/
skb_pull(skb, tunnel->hlen + sizeof(struct iphdr));
skb_reset_mac_header(skb);
} else {
if (skb_cow_head(skb, dev->needed_headroom))
goto free_skb;

tnl_params = &tunnel->parms.iph;
}

skb = gre_handle_offloads(skb, !!(tunnel->parms.o_flags&TUNNEL_CSUM));
if (IS_ERR(skb))
goto out;

__gre_xmit(skb, dev, tnl_params, skb->protocol);

return NETDEV_TX_OK;
Expand Down

0 comments on commit 8a0033a

Please sign in to comment.