netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [ICMP]: Fix icmp_errors_use_inbound_ifaddr sysctl
@ 2007-06-01 17:24 Patrick McHardy
  2007-06-01 18:45 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick McHardy @ 2007-06-01 17:24 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List

[-- Attachment #1: Type: text/plain, Size: 104 bytes --]

It seems like you missed this patch in the previous thread discussing
the problem, so here's a resend.


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1609 bytes --]

[ICMP]: Fix icmp_errors_use_inbound_ifaddr sysctl

Currently when icmp_errors_use_inbound_ifaddr is set and an ICMP error is
sent after the packet passed through ip_output(), an address from the
outgoing interface is chosen as ICMP source address since skb->dev doesn't
point to the incoming interface anymore.

Fix this by doing an interface lookup on rt->dst.iif and using that device.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit f680f41a1c6b2c358a4725e763132b3c61c1685a
tree 81f9cd86744aca6e7c2bc647639f7868d7ceb1d3
parent 19b6cbad06d246d48168fc6c493a7c3d9db58e1f
author Patrick McHardy <kaber@trash.net> Fri, 01 Jun 2007 19:22:21 +0200
committer Patrick McHardy <kaber@trash.net> Fri, 01 Jun 2007 19:22:21 +0200

 net/ipv4/icmp.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

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;
 	}
 

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

* Re: [ICMP]: Fix icmp_errors_use_inbound_ifaddr sysctl
  2007-06-01 17:24 [ICMP]: Fix icmp_errors_use_inbound_ifaddr sysctl Patrick McHardy
@ 2007-06-01 18:45 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-06-01 18:45 UTC (permalink / raw)
  To: kaber; +Cc: netdev

From: Patrick McHardy <kaber@trash.net>
Date: Fri, 01 Jun 2007 19:24:18 +0200

> It seems like you missed this patch in the previous thread discussing
> the problem, so here's a resend.

Thanks for resending, applied, thanks Patrick.

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

end of thread, other threads:[~2007-06-01 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-01 17:24 [ICMP]: Fix icmp_errors_use_inbound_ifaddr sysctl Patrick McHardy
2007-06-01 18:45 ` David Miller

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).