From: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 02/16] ipv4: Deliver ICMP redirects to sockets too.
Date: Thu, 12 Jul 2012 23:58:37 +0900 [thread overview]
Message-ID: <20120712235837.4d611326830a16f9a035dd75@gmail.com> (raw)
In-Reply-To: <20120712.011049.831106026936792516.davem@davemloft.net>
On Thu, 12 Jul 2012 01:10:49 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
>
> And thus, we can remove the ping_err() hack.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> net/ipv4/icmp.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
> index 18e39d1..5885146 100644
> --- a/net/ipv4/icmp.c
> +++ b/net/ipv4/icmp.c
> @@ -782,13 +782,7 @@ static void icmp_redirect(struct sk_buff *skb)
> break;
> }
>
> - /* Ping wants to see redirects.
> - * Let's pretend they are errors of sorts... */
> - if (iph->protocol == IPPROTO_ICMP &&
> - iph->ihl >= 5 &&
> - pskb_may_pull(skb, (iph->ihl<<2)+8)) {
> - ping_err(skb, icmp_hdr(skb)->un.gateway);
> - }
> + icmp_socket_deliver(skb, icmp_hdr(skb)->un.gateway);
icmp_redirect() just checks skb->len is larger than
sizeof(struct iphdr) and then ping_err() is called.
In ping_err(), *icmph is derived from following code without
sanity check of skb->len. So, I think avobe deleted checks about
skb->len need to move to ping_err() in case of packets are malformed.
struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2))
next prev parent reply other threads:[~2012-07-12 14:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 8:10 [PATCH 02/16] ipv4: Deliver ICMP redirects to sockets too David Miller
2012-07-12 14:58 ` Hiroaki SHIMODA [this message]
2012-07-12 15:06 ` David Miller
2012-07-12 15:21 ` Hiroaki SHIMODA
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120712235837.4d611326830a16f9a035dd75@gmail.com \
--to=shimoda.hiroaki@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).