ipv4: fix a bug in ping_err().
Subsystems (2)
PATCH 1/1 ipv4: fix a bug in ping_err().
We should get 'type' and 'code' from the outer ICMP header.
--- net/ipv4/ping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ping.c +2 -2
@@ -322,8 +322,8 @@ void ping_err(struct sk_buff *skb, u32 info)struct iphdr *iph = (struct iphdr *)skb->data;struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2 ));struct inet_sock *inet_sock; -int type = icmph->type; -int code = icmph->code; +int type =icmp_hdr (skb)->type; +int code =icmp_hdr (skb)->code;struct net *net =dev_net (skb->dev);struct sock *sk;int harderr;
Signature · 1 line
1.8.0.2
David Miller
maintainerFrom: Li Wei <[email protected]>
Date: Thu, 21 Feb 2013 18:09:54 +0800
Quoted 12 lines
We should get 'type' and 'code' from the outer ICMP header.
Signed-off-by Li Wei <[email protected]>--- net/ipv4/ping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/ipv4/ping.c +0
-0
net/ipv4/ping.c void ping_err(struct sk_buff *skb, u32 info) · line 326
Quoted 7 lines
net/ipv4/ping.c +2
-2@@ -322,8 +322,8 @@ void ping_err(struct sk_buff *skb, u32 info)struct iphdr *iph = (struct iphdr *)skb->data;struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2 ));struct inet_sock *inet_sock; -int type = icmph->type; -int code = icmph->code; +int type =icmp_hdr (skb)->type; +int code =icmp_hdr (skb)->code;
Isn't that the same thing at this point? skb->data points to the outer IPv4 header at this point, doesn't it?
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Thu, 21 Feb 2013 13:08:09 -0500 (EST)
Quoted 10 lines
From: Li Wei <[email protected]>
Date: Thu, 21 Feb 2013 18:09:54 +0800Quoted 7 lines
We should get 'type' and 'code' from the outer ICMP header.
Signed-off-by Li Wei <[email protected]>--- net/ipv4/ping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines
net/ipv4/ping.c void ping_err(struct sk_buff *skb, u32 info) · line 326
Quoted 12 lines
net/ipv4/ping.c +2
-2@@ -322,8 +322,8 @@ void ping_err(struct sk_buff *skb, u32 info)struct iphdr *iph = (struct iphdr *)skb->data;struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2 ));struct inet_sock *inet_sock; -int type = icmph->type; -int code = icmph->code; +int type =icmp_hdr (skb)->type; +int code =icmp_hdr (skb)->code;Isn't that the same thing at this point?
skb->datapoints to the outer IPv4 header at this point, doesn't it?
Answering myself...
Obviously it isn't, ip_rcv() __skb_pull()'s the IP header before it calls down into ICMP, so we have to use the transport header here.
Applied and queued up for -stable, thanks.