Skip to contentSkip to conversation

act_nat: not all of the ICMP packets need an IP header payload

PATCH In review Changli Gao 4 participants 5 messages Jul 10, 2010 – Jul 13, 2010

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

PATCH 1/1 act_nat: not all of the ICMP packets need an IP header payload

act_nat: not all of the ICMP packets need an IP header payload

not all of the ICMP packets need an IP header payload, so we check the length of the skbs only when the packets should have an IP header payload.

----

 net/sched/act_nat.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/sched/act_nat.c +4 -1
index 0be49a4..24e614c 100644
@@ -205,7 +205,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 	{
 		struct icmphdr *icmph;
 
-		if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
+		if (!pskb_may_pull(skb, ihl + sizeof(*icmph)))
 			goto drop;
 
 		icmph = (void *)(skb_network_header(skb) + ihl);
@@ -215,6 +215,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 		    (icmph->type != ICMP_PARAMETERPROB))
 			break;
 
+		if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
+			goto drop;
+
 		iph = (void *)(icmph + 1);
 		if (egress)
 			addr = iph->daddr;
#1 lore raw
Quoted 23 lines · Changli Gao

act_nat: not all of the ICMP packets need an IP header payload

not all of the ICMP packets need an IP header payload, so we check the length of the skbs only when the packets should have an IP header payload.

----

 net/sched/act_nat.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/sched/act_nat.c +1 -1
index 0be49a4..24e614c 100644
@@ -205,7 +205,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 	{
 		struct icmphdr *icmph;
 
-		if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
+		if (!pskb_may_pull(skb, ihl + sizeof(*icmph)))
 			goto drop;
 
 		icmph = (void *)(skb_network_header(skb) + ihl);

net/sched/act_nat.c static int tcf_nat(struct sk_buff *skb, struct tc_action *a, · line 223

Quoted 9 lines
net/sched/act_nat.c +3 -0
@@ -215,6 +215,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 		    (icmph->type != ICMP_PARAMETERPROB))
 			break;
 
+		if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
+			goto drop;
+
 		iph = (void *)(icmph + 1);
 		if (egress)
 			addr = iph->daddr;

Changli, this patch has no attribution.

Rodrigo spent lot of time to find the problem and is willing to fix it.

Could you please give a chance to Rodrigo to complete its first kernel patch ?

Thanks

#2 lore raw
Quoted 9 lines · Eric Dumazet

Le samedi 10 juillet 2010 à 09:33 +0800, Changli Gao a écrit :

Changli, this patch has no attribution.

Rodrigo spent lot of time to find the problem and is willing to fix it.

Could you please give a chance to Rodrigo to complete its first kernel patch ?

Oh. Sorry. The honor belongs to him. I think he can give his Sigh off, if he thinks this patch is OK.

Signature · 2 lines
Regards,
Changli Gao([email protected])
maintainer Acked-by Herbert Xu
#3 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Sat, 10 Jul 2010 08:22:33 +0200

Quoted 1 line

Rodrigo spent lot of time to find the problem and is willing to fix it.

I gave Rodrigo suitable credit in the final commit message.

--------------------
From 70c2efa5a32a7d38e66224844032160317fa7887 Mon Sep 17 00:00:00 2001
From: Changli Gao <[email protected]>
Date: Fri, 9 Jul 2010 15:33:25 +0000
Subject: [PATCH] act_nat: not all of the ICMP packets need an IP header payload
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

not all of the ICMP packets need an IP header payload, so we check the length of the skbs only when the packets should have an IP header payload.

Based upon analysis and initial patch by Rodrigo Partearroyo González.

--------------------

Acked-by on v1 1/1
#4 lore raw
In reply to Changli Gao
Quoted 6 lines · Changli Gao

act_nat: not all of the ICMP packets need an IP header payload

not all of the ICMP packets need an IP header payload, so we check the length of the skbs only when the packets should have an IP header payload.

Thanks!

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt