[NET]: Allow forwarding of ip_summed except CHECKSUM_COMPLETE
Right now Xen has a horrible hack that lets it forward packets with partial checksums. One of the reasons that CHECKSUM_PARTIAL and CHECKSUM_COMPLETE were added is so that we can get rid of this hack (where it creates two extra bits in the skbuff to essentially mirror ip_summed without being destroyed by the forwarding code). I had forgotten that I've already gone through all the deivce drivers last time around to make sure that they're looking at ip_summed == CHECKSUM_PARTIAL rather than ip_summed != 0 on transmit. In any case, I've now done that again so it should definitely be safe. Unfortunately nobody has yet added any code to update CHECKSUM_COMPLETE values on forward so we I'm setting that to CHECKSUM_NONE. This should be safe to remove for bridging but I'd like to check that code path first. So here is the patch that lets us get rid of the hack by preserving ip_summed (mostly) on forwarded packets. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2d771cd86d
commit
35fc92a9de
4 changed files with 10 additions and 3 deletions
|
@ -1654,5 +1654,12 @@ static inline int skb_is_gso(const struct sk_buff *skb)
|
||||||
return skb_shinfo(skb)->gso_size;
|
return skb_shinfo(skb)->gso_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void skb_forward_csum(struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
/* Unfortunately we don't support this one. Any brave souls? */
|
||||||
|
if (skb->ip_summed == CHECKSUM_COMPLETE)
|
||||||
|
skb->ip_summed = CHECKSUM_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
#endif /* _LINUX_SKBUFF_H */
|
#endif /* _LINUX_SKBUFF_H */
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void __br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
|
||||||
|
|
||||||
indev = skb->dev;
|
indev = skb->dev;
|
||||||
skb->dev = to->dev;
|
skb->dev = to->dev;
|
||||||
skb->ip_summed = CHECKSUM_NONE;
|
skb_forward_csum(skb);
|
||||||
|
|
||||||
NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, indev, skb->dev,
|
NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, indev, skb->dev,
|
||||||
br_forward_finish);
|
br_forward_finish);
|
||||||
|
|
|
@ -67,7 +67,7 @@ int ip_forward(struct sk_buff *skb)
|
||||||
if (skb->pkt_type != PACKET_HOST)
|
if (skb->pkt_type != PACKET_HOST)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
skb->ip_summed = CHECKSUM_NONE;
|
skb_forward_csum(skb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* According to the RFC, we must first decrease the TTL field. If
|
* According to the RFC, we must first decrease the TTL field. If
|
||||||
|
|
|
@ -378,7 +378,7 @@ int ip6_forward(struct sk_buff *skb)
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
skb->ip_summed = CHECKSUM_NONE;
|
skb_forward_csum(skb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We DO NOT make any processing on
|
* We DO NOT make any processing on
|
||||||
|
|
Loading…
Reference in a new issue