Skip to contentSkip to conversation

netfilter: reject: fix ICMP csum verification

PATCH In review Alin Nastac 2 participants 3 messages Aug 29, 2019 – Aug 30, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: reject: fix ICMP csum verification

From: Alin Nastac <[email protected]>

Typically transport protocols such as TCP and UDP use an IP pseudo-header for their checksum computation, but ICMP does not use it.

Fixes 7fc38225363dd ("netfilter: reject: skip csum verification for protocols that don't support it")
---
 net/ipv4/netfilter/nf_reject_ipv4.c | 4 ++++
 1 file changed, 4 insertions(+)
net/ipv4/netfilter/nf_reject_ipv4.c +4 -0
index 2361fda..4d2e956 100644
@@ -180,6 +180,10 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook)
 		return;
 	}
 
+	/* ICMP checksum computation does not use an IP pseudo-header */
+	if (proto == IPPROTO_ICMP)
+	  proto = 0;
+
 	if (nf_ip_checksum(skb_in, hook, ip_hdrlen(skb_in), proto) == 0)
 		icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0);
 }
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Alin Nastac

From: Alin Nastac <[email protected]>

Typically transport protocols such as TCP and UDP use an IP pseudo-header for their checksum computation, but ICMP does not use it.

Already fixed upstream?

commit 5d1549847c76b1ffcf8e388ef4d0f229bdd1d7e8

Author: He Zhe <[email protected]>
Date:   Mon Jun 24 11:17:38 2019 +0800

netfilter: Fix remainder of pseudo-header protocol 0

#2 lore raw
Quoted 7 lines · Pablo Neira Ayuso

Already fixed upstream?

commit 5d1549847c76b1ffcf8e388ef4d0f229bdd1d7e8

Author: He Zhe <[email protected]>
Date:   Mon Jun 24 11:17:38 2019 +0800

netfilter: Fix remainder of pseudo-header protocol 0

Yup, discard my patch pls.