netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francesco Fusco <ffusco@redhat.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next] sysctl: accept_redirects do not change when disabling ip_forwarding
Date: Fri,  9 Aug 2013 10:08:59 +0200	[thread overview]
Message-ID: <b560b71eadb678de8a573f18a10f840bf0a68df0.1375979491.git.ffusco@redhat.com> (raw)

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

             reply	other threads:[~2013-08-09  8:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  8:08 Francesco Fusco [this message]
2013-08-09  8:20 ` [PATCH net-next] sysctl: accept_redirects do not change when disabling ip_forwarding David Miller

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=b560b71eadb678de8a573f18a10f840bf0a68df0.1375979491.git.ffusco@redhat.com \
    --to=ffusco@redhat.com \
    --cc=davem@davemloft.net \
    --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).