Skip to content

Commit

Permalink
ipip: capture inner headers during encapsulation
Browse files Browse the repository at this point in the history
Allow IPIP to make use of tx-checksum offloading.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pravin B Shelar authored and David S. Miller committed Mar 9, 2013
1 parent 8344bfc commit 4f3ed92
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions net/ipv4/ipip.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)

if (skb->protocol != htons(ETH_P_IP))
goto tx_error;

if (skb->ip_summed == CHECKSUM_PARTIAL &&
skb_checksum_help(skb))
goto tx_error;

old_iph = ip_hdr(skb);

if (tos & 1)
Expand Down Expand Up @@ -572,6 +567,13 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
old_iph = ip_hdr(skb);
}

if (!skb->encapsulation) {
skb_reset_inner_headers(skb);
skb->encapsulation = 1;
}
if (skb->ip_summed != CHECKSUM_PARTIAL)
skb->ip_summed = CHECKSUM_NONE;

skb->transport_header = skb->network_header;
skb_push(skb, sizeof(struct iphdr));
skb_reset_network_header(skb);
Expand Down Expand Up @@ -599,7 +601,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
iph->ttl = old_iph->ttl;

nf_reset(skb);
skb->ip_summed = CHECKSUM_NONE;

pkt_len = skb->len - skb_transport_offset(skb);
err = ip_local_out(skb);
Expand Down

0 comments on commit 4f3ed92

Please sign in to comment.