net: Support for csum_bad in skbuff
This flag indicates that an invalid checksum was detected in the packet. __skb_mark_checksum_bad helper function was added to set this. Checksums can be marked bad from a driver or the GRO path (the latter is implemented in this patch). csum_bad is checked in __skb_checksum_validate_complete (i.e. calling that when ip_summed == CHECKSUM_NONE). csum_bad works in conjunction with ip_summed value. In the case that ip_summed is CHECKSUM_NONE and csum_bad is set, this implies that the first (or next) checksum encountered in the packet is bad. When ip_summed is CHECKSUM_UNNECESSARY, the first checksum after the last one validated is bad. For example, if ip_summed == CHECKSUM_UNNECESSARY, csum_level == 1, and csum_bad is set-- then the third checksum in the packet is bad. In the normal path, the packet will be dropped when processing the protocol layer of the bad checksum: __skb_decr_checksum_unnecessary called twice for the good checksums changing ip_summed to CHECKSUM_NONE so that __skb_checksum_validate_complete is called to validate the third checksum and that will fail since csum_bad is set. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
52aec126c4
commit
5a21232983
3 changed files with 24 additions and 3 deletions
|
@ -2216,7 +2216,9 @@ static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
|
|||
if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
|
||||
__ret = __skb_gro_checksum_validate_complete(skb, \
|
||||
compute_pseudo(skb, proto)); \
|
||||
if (!__ret) \
|
||||
if (__ret) \
|
||||
__skb_mark_checksum_bad(skb); \
|
||||
else \
|
||||
skb_gro_incr_csum_unnecessary(skb); \
|
||||
__ret; \
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue