netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] sysctl: accept_redirects do not change when disabling ip_forwarding
@ 2013-08-09  8:08 Francesco Fusco
  2013-08-09  8:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Francesco Fusco @ 2013-08-09  8:08 UTC (permalink / raw)
  To: davem; +Cc: netdev

The sysctl behavior in the current kernel in not in synch with what is stated
in the ip-sysctl.txt documentation file. When disabling ip_forwarding the
net.ipv4.conf.all.accept_redirects is enabled without warning even if all the
accept_redirects were set to zero.

1. Set initial values of accept_redirects to zero:
	sysctl -w net.ipv4.ip_forward=1
	for i in `ls /proc/sys/net/ipv4/conf/` 
	do 
		sysctl -w net.ipv4.conf.$i.accept_redirects=0 
	done

2. Disable ip_forwarding.
	sysctl -w net.ipv4.ip_forward=0

3. Now net.ipv4.conf.all.accept_redirects will be enabled:
	syctl net.ipv4.conf.all.accept_redirects
	net.ipv4.conf.all.accept_redirects = 1

This patch prevents this issue and net.ipv4.conf.all.accept_redirects won't
be set to one after disabling forwarding.

Reported-by: Karthik <karthik@live.fi>
Signed-off-by: Francesco Fusco <ffusco@redhat.com>
---
 net/ipv4/devinet.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 43923dc..e668c3e 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1917,7 +1917,6 @@ static void inet_forward_change(struct net *net)
 	struct net_device *dev;
 	int on = IPV4_DEVCONF_ALL(net, FORWARDING);
 
-	IPV4_DEVCONF_ALL(net, ACCEPT_REDIRECTS) = !on;
 	IPV4_DEVCONF_DFLT(net, FORWARDING) = on;
 	inet_netconf_notify_devconf(net, NETCONFA_FORWARDING,
 				    NETCONFA_IFINDEX_ALL,
-- 
1.8.3.1

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

* Re: [PATCH net-next] sysctl: accept_redirects do not change when disabling ip_forwarding
  2013-08-09  8:08 [PATCH net-next] sysctl: accept_redirects do not change when disabling ip_forwarding Francesco Fusco
@ 2013-08-09  8:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-08-09  8:20 UTC (permalink / raw)
  To: ffusco; +Cc: netdev

From: Francesco Fusco <ffusco@redhat.com>
Date: Fri,  9 Aug 2013 10:08:59 +0200

> The sysctl behavior in the current kernel in not in synch with what is stated
> in the ip-sysctl.txt documentation file. When disabling ip_forwarding the
> net.ipv4.conf.all.accept_redirects is enabled without warning even if all the
> accept_redirects were set to zero.

The behavior is intentional because a router should not respond to redirects.

Fix the documentation file instead, thank you.

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

end of thread, other threads:[~2013-08-09  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-09  8:08 [PATCH net-next] sysctl: accept_redirects do not change when disabling ip_forwarding Francesco Fusco
2013-08-09  8:20 ` 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).