Netdev List
 help / color / mirror / Atom feed
From: Lennert Buytenhek <buytenh@wantstofly.org>
To: netdev@oss.sgi.com
Subject: Re: [PATCH 1/1] sysctl configurable icmperror sourceaddress
Date: Wed, 8 Jun 2005 23:45:40 +0200	[thread overview]
Message-ID: <20050608214540.GF28207@xi.wantstofly.org> (raw)
In-Reply-To: <1118136384.10479.15.camel@jeroens.office.netland.nl>

On Tue, Jun 07, 2005 at 11:26:23AM +0200, J. Simonetti wrote:

> This patch alows you to change the source address of icmp error
> messages. It applies cleanly to 2.6.11.11 and retains the default
> behaviour.
> 
> In the old (default) behaviour icmp error messages are sent with the ip
> of the exiting interface.
> The new behaviour (when the sysctl variable is toggled on), it will send
> the message with the ip of the interface that received the packet that
> caused the icmp error. This is the behaviour network administrators will
> expect from a router. It makes debugging complicated network layouts
> much easier. Also, all 'vendor routers' I know of have the later
> behaviour.

Can this patch go in, pretty please?

Here's the patch again for reference:


--- include/linux/sysctl.h.orig	2004-12-24 22:34:58.000000000 +0100
+++ include/linux/sysctl.h	2005-06-07 10:16:39.730585288 +0200
@@ -345,6 +345,7 @@
 	NET_TCP_MODERATE_RCVBUF=106,
 	NET_TCP_TSO_WIN_DIVISOR=107,
	NET_TCP_BIC_BETA=108,
+	NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
 };
 
 enum {
--- net/ipv4/icmp.c.orig	2004-12-24 22:35:28.000000000 +0100
+++ net/ipv4/icmp.c	2005-06-07 10:15:42.645263576 +0200
@@ -207,6 +207,7 @@
 
 int sysctl_icmp_ratelimit = 1 * HZ;
 int sysctl_icmp_ratemask = 0x1818;
+int sysctl_icmp_errors_use_inbound_ifaddr = 0;
 
 /*
  *	ICMP control array. This specifies what to do with each ICMP.
@@ -511,8 +512,12 @@
 	 */
 
 	saddr = iph->daddr;
-	if (!(rt->rt_flags & RTCF_LOCAL))
-		saddr = 0;
+	if (!(rt->rt_flags & RTCF_LOCAL)) {
+		if(sysctl_icmp_errors_use_inbound_ifaddr)
+			saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK);
+		else
+			saddr = 0;
+	}
 
 	tos = icmp_pointers[type].error ? ((iph->tos & IPTOS_TOS_MASK) |
 					   IPTOS_PREC_INTERNETCONTROL) :
--- net/ipv4/sysctl_net_ipv4.c.orig	2004-12-24 22:35:23.000000000 +0100
+++ net/ipv4/sysctl_net_ipv4.c	2005-06-07 10:19:44.538490216 +0200
@@ -23,6 +23,7 @@
 extern int sysctl_icmp_echo_ignore_all;
 extern int sysctl_icmp_echo_ignore_broadcasts;
 extern int sysctl_icmp_ignore_bogus_error_responses;
+extern int sysctl_icmp_errors_use_inbound_ifaddr;
 
 /* From ip_fragment.c */
 extern int sysctl_ipfrag_low_thresh;
@@ -396,6 +397,14 @@
 		.proc_handler	= &proc_dointvec
 	},
 	{
+		.ctl_name	= NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
+		.procname	= "icmp_errors_use_inbound_ifaddr",
+		.data		= &sysctl_icmp_errors_use_inbound_ifaddr,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+	{
 		.ctl_name	= NET_IPV4_ROUTE,
 		.procname	= "route",
 		.maxlen		= 0,

  parent reply	other threads:[~2005-06-08 21:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-07  9:26 [PATCH 1/1] sysctl configurable icmperror sourceaddress J. Simonetti
2005-06-07  9:40 ` J. Simonetti
2005-06-08 21:45 ` Lennert Buytenhek [this message]
2005-06-08 21:49   ` David S. Miller
2005-06-08 23:40     ` Lennert Buytenhek

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=20050608214540.GF28207@xi.wantstofly.org \
    --to=buytenh@wantstofly.org \
    --cc=netdev@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox