Skip to content

Commit 5bed9f3

Browse files
arkevmitchummakynes
authored andcommitted
netfilter: conntrack: mark UDP zero checksum as CHECKSUM_UNNECESSARY
The udp_error function verifies the checksum of incoming UDP packets if one is set. This has the desirable side effect of setting skb->ip_summed to CHECKSUM_COMPLETE, signalling that this verification need not be repeated further up the stack. Conversely, when the UDP checksum is empty, which is perfectly legal (at least inside IPv4), udp_error previously left no trace that the checksum had been deemed acceptable. This was a problem in particular for nf_reject_ipv4, which verifies the checksum in nf_send_unreach() before sending ICMP_DEST_UNREACH. It makes no accommodation for zero UDP checksums unless they are already marked as CHECKSUM_UNNECESSARY. This commit ensures packets with empty UDP checksum are marked as CHECKSUM_UNNECESSARY, which is explicitly recommended in skbuff.h. Signed-off-by: Kevin Mitchell <[email protected]> Acked-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 41414c9 commit 5bed9f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/netfilter/nf_conntrack_proto_udp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ static bool udp_error(struct sk_buff *skb,
6363
}
6464

6565
/* Packet with no checksum */
66-
if (!hdr->check)
66+
if (!hdr->check) {
67+
skb->ip_summed = CHECKSUM_UNNECESSARY;
6768
return false;
69+
}
6870

6971
/* Checksum invalid? Ignore.
7072
* We skip checking packets on the outgoing path

0 commit comments

Comments
 (0)