From: Patrick McHardy <kaber@trash.net>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, jmorris@namei.org, Curtis@GreenKey.net
Subject: Re: oops in net/ipv4/icmp.c:icmp_send() with icmp_errors_use_inbound_ifaddr (fwd)
Date: Mon, 21 May 2007 19:03:24 +0200 [thread overview]
Message-ID: <4651D0DC.6050203@trash.net> (raw)
In-Reply-To: <20070519.145042.105428414.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]
David Miller wrote:
> The post ip_output() case is very unfortunate. Perhaps we
> can tag the call sites, or if that doesn't work we can
> find some way to perhaps tag the dst as an input vs. output
> route in order to avoid this problem.
Tagging call-sites should make sure we don't use an address from the
outgoing device, but we would still not always use an address from
the incoming device.
Thinking again, we can simply perform a lookup on rt->fl.iif, that
should always do the right thing.
Signed-off-by: Patrick McHardy <kaber@trash.net>
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 783 bytes --]
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index e238b17..02a899b 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -514,12 +514,15 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
saddr = iph->daddr;
if (!(rt->rt_flags & RTCF_LOCAL)) {
- /* This is broken, skb_in->dev points to the outgoing device
- * after the packet passes through ip_output().
- */
- if (skb_in->dev && sysctl_icmp_errors_use_inbound_ifaddr)
- saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK);
- else
+ struct net_device *dev = NULL;
+
+ if (rt->fl.iif && sysctl_icmp_errors_use_inbound_ifaddr)
+ dev = dev_get_by_index(rt->fl.iif);
+
+ if (dev) {
+ saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
+ dev_put(dev);
+ } else
saddr = 0;
}
next prev parent reply other threads:[~2007-05-21 17:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-14 18:30 oops in net/ipv4/icmp.c:icmp_send() with icmp_errors_use_inbound_ifaddr (fwd) James Morris
2007-05-14 18:46 ` Patrick McHardy
2007-05-14 19:19 ` Patrick McHardy
2007-05-17 16:52 ` Patrick McHardy
2007-05-18 0:57 ` Julian Anastasov
2007-05-19 21:50 ` David Miller
2007-05-21 17:03 ` Patrick McHardy [this message]
2007-05-20 5:26 ` Herbert Xu
2007-05-21 16:36 ` Patrick McHardy
2007-05-21 21:28 ` Herbert Xu
2007-05-21 21:32 ` Patrick McHardy
2007-05-14 20:24 ` Curtis Doty
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=4651D0DC.6050203@trash.net \
--to=kaber@trash.net \
--cc=Curtis@GreenKey.net \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--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).