mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Gabriel Goller <g.goller@proxmox.com>
Subject: [PATCH net-next] ipv6: reset all.force_forwarding when disabling all.forwarding
Date: Mon, 09 Nov 2026 16:53:08 +0100	[thread overview]
Message-ID: <20261109-ipv6_reset_all-v1-1-815dfd508246@proxmox.com> (raw)

Disabling all.forwarding resets force_forwarding on every interface, but
leaves all.force_forwarding set:

  # sysctl -wq net.ipv6.conf.all.forwarding=1
  # sysctl -wq net.ipv6.conf.all.force_forwarding=1
  # sysctl -wq net.ipv6.conf.all.forwarding=0
  # sysctl net.ipv6.conf.dummy1.force_forwarding
  net.ipv6.conf.dummy1.force_forwarding = 0
  # sysctl net.ipv6.conf.all.force_forwarding
  net.ipv6.conf.all.force_forwarding = 1

Writing 1 to all.force_forwarding afterwards is ignored because the
value did not change, so the interfaces are not re-enabled.

Reset all.force_forwarding too and notify netconf listeners.

Suggested-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 net/ipv6/addrconf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d9d13e78bf13..9007a58039e6 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -905,6 +905,14 @@ static int addrconf_fixup_forwarding(const struct ctl_table *table, int *p, int
 						     net->ipv6.devconf_dflt);
 
 		addrconf_forward_change(net, newf);
+		/* Disabling all.forwarding also resets all.force_forwarding */
+		if (newf == 0 && net->ipv6.devconf_all->force_forwarding) {
+			WRITE_ONCE(net->ipv6.devconf_all->force_forwarding, 0);
+			inet6_netconf_notify_devconf(net, RTM_NEWNETCONF,
+						     NETCONFA_FORCE_FORWARDING,
+						     NETCONFA_IFINDEX_ALL,
+						     net->ipv6.devconf_all);
+		}
 		if ((!newf) ^ (!old))
 			inet6_netconf_notify_devconf(net, RTM_NEWNETCONF,
 						     NETCONFA_FORWARDING,

---
base-commit: fa5196392691051963726787944db872420dfa75
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git main
change-id: 20261109-ipv6_reset_all-1452fdf29254

Best regards,
--  
Gabriel Goller <g.goller@proxmox.com>



             reply	other threads:[~2026-11-09 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 15:53 Gabriel Goller [this message]
2026-11-10 17:34 ` Nicolas Dichtel

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=20261109-ipv6_reset_all-v1-1-815dfd508246@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®