netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] act_nat: not all of the ICMP packets need an IP header payload
@ 2010-07-10  1:33 Changli Gao
  2010-07-10  6:22 ` Eric Dumazet
  2010-07-10  6:26 ` Herbert Xu
  0 siblings, 2 replies; 5+ messages in thread
From: Changli Gao @ 2010-07-10  1:33 UTC (permalink / raw)
  To: David S. Miller
  Cc: Jamal Hadi Salim, Rodrigo Partearroyo González, Herbert Xu,
	Eric Dumazet, Iratxo Pichel Ortiz, Noelia Morón, netdev,
	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.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/sched/act_nat.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 0be49a4..24e614c 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-13  3:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-10  1:33 [PATCH] act_nat: not all of the ICMP packets need an IP header payload Changli Gao
2010-07-10  6:22 ` Eric Dumazet
2010-07-10 14:08   ` Changli Gao
2010-07-13  3:02   ` David Miller
2010-07-10  6:26 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).