From: Stephen Hemminger <shemminger@vyatta.com>
To: Wei Yongjun <yjwei@cn.fujitsu.com>
Cc: Jarek Poplawski <jarkao2@gmail.com>,
Li Yewang <lyw@cn.fujitsu.com>,
davem@davemloft.net, swhiteho@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH] Can not send icmp netunreach packet
Date: Tue, 26 Feb 2008 07:34:35 -0800 [thread overview]
Message-ID: <20080226073435.1765de3e@extreme> (raw)
In-Reply-To: <47C3E2EC.1020402@cn.fujitsu.com>
On Tue, 26 Feb 2008 18:59:08 +0900
Wei Yongjun <yjwei@cn.fujitsu.com> wrote:
> Jarek Poplawski wrote:
>
> Maybe ip_error() does not handle the ESRCH error. In this place ESRCH eq
> to ENETUNREACH?
>
> static int ip_error(struct sk_buff *skb)
> {
> struct rtable *rt = (struct rtable*)skb->dst;
> unsigned long now;
> int code;
>
> switch (rt->u.dst.error) {
> case EINVAL:
> default:
> goto out;
> case EHOSTUNREACH:
> code = ICMP_HOST_UNREACH;
> break;
> case ENETUNREACH:
> code = ICMP_NET_UNREACH;
> break;
> case EACCES:
> code = ICMP_PKT_FILTERED;
> break;
> }
> ...............snip....................
> }
>
>
>
> > On 26-02-2008 07:34, Li Yewang wrote:
> >
> >> Hi All
> >>
> >> There is a bug about icmp netunreach.
> >> If the kernel does not find a route for a packet,
> >> it must send a icmp netunreach packet to the source host,
> >> and discard the packet. But the kernel does not send
> >> a icmp netunreach packet because of the fib_lookup
> >> return value of -ESRCH when a route is not found.
> >>
> >
> > ...or because some function doesn't handle -ESRCH return from
> > fib_lookup? It seems changing this to -ESRCH was needed in some cases.
> > And you don't explain enough why it can't be handled later (like in
> > ipv4/route.c: ip_route_input_slow)?
> >
>
>
> > Regards,
> > Jarek P.
> >
> >
> >> Signed-off-by: Li Yewang <lyw@cn.fujitsu.com>
> >>
> >> diff -Nurp net/core_back/fib_rules.c net/core/fib_rules.c
> >> --- net/core_back/fib_rules.c 2008-02-25 13:15:37.000000000 +0800
> >> +++ net/core/fib_rules.c 2008-02-25 13:16:01.000000000 +0800
> >> @@ -188,7 +188,7 @@ jumped:
> >> }
> >> }
> >>
> >> - err = -ESRCH;
> >> + err = -ENETUNREACH;
> >> out:
> >> rcu_read_unlock();
> >>
> >>
The switch shouldn't see a problem because ENETUNREACH is already substituted
for ESRCH in:
static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev)
{
...
/*
* Now we are ready to route packet.
*/
if ((err = fib_lookup(net, &fl, &res)) != 0) {
if (!IN_DEV_FORWARD(in_dev))
goto e_hostunreach;
goto no_route;
...
no_route:
RT_CACHE_STAT_INC(in_no_route);
spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
res.type = RTN_UNREACHABLE;
if (err == -ESRCH)
err = -ENETUNREACH;
goto local_input;
next prev parent reply other threads:[~2008-02-26 15:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-26 6:34 [PATCH] Can not send icmp netunreach packet Li Yewang
2008-02-26 7:35 ` Jarek Poplawski
2008-02-26 9:59 ` Wei Yongjun
2008-02-26 10:55 ` Jarek Poplawski
2008-02-26 15:34 ` Stephen Hemminger [this message]
2008-02-26 21:30 ` David Miller
2008-02-26 22:44 ` Jarek Poplawski
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=20080226073435.1765de3e@extreme \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=jarkao2@gmail.com \
--cc=lyw@cn.fujitsu.com \
--cc=netdev@vger.kernel.org \
--cc=swhiteho@redhat.com \
--cc=yjwei@cn.fujitsu.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.