Skip to content

Commit b85f628

Browse files
wdebruijkuba-moo
authored andcommitted
packet: do not set TP_STATUS_CSUM_VALID on CHECKSUM_COMPLETE
CHECKSUM_COMPLETE signals that skb->csum stores the sum over the entire packet. It does not imply that an embedded l4 checksum field has been validated. Fixes: 682f048 ("af_packet: pass checksum validation status to the user") Signed-off-by: Willem de Bruijn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0e682f0 commit b85f628

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/packet/af_packet.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,8 +2293,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
22932293
if (skb->ip_summed == CHECKSUM_PARTIAL)
22942294
status |= TP_STATUS_CSUMNOTREADY;
22952295
else if (skb->pkt_type != PACKET_OUTGOING &&
2296-
(skb->ip_summed == CHECKSUM_COMPLETE ||
2297-
skb_csum_unnecessary(skb)))
2296+
skb_csum_unnecessary(skb))
22982297
status |= TP_STATUS_CSUM_VALID;
22992298

23002299
if (snaplen > res)
@@ -3520,8 +3519,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
35203519
if (skb->ip_summed == CHECKSUM_PARTIAL)
35213520
aux.tp_status |= TP_STATUS_CSUMNOTREADY;
35223521
else if (skb->pkt_type != PACKET_OUTGOING &&
3523-
(skb->ip_summed == CHECKSUM_COMPLETE ||
3524-
skb_csum_unnecessary(skb)))
3522+
skb_csum_unnecessary(skb))
35253523
aux.tp_status |= TP_STATUS_CSUM_VALID;
35263524

35273525
aux.tp_len = origlen;

0 commit comments

Comments
 (0)