ipv6: Add NETCONFA_FORCE_FORWARDING to netconf messages
Subsystems (3)
PATCH v2 1/1 ipv6: Add NETCONFA_FORCE_FORWARDING to netconf messages
Since force_forwarding was added, changing the sysctl sends an RTM_NEWNETCONF notification of type NETCONFA_FORCE_FORWARDING, but inet6_netconf_fill_devconf() never emits the attribute. Listeners only receive NETCONFA_IFINDEX without the new value, and RTM_GETNETCONF replies and dumps omit it as well.
Also send a notification when disabling all.forwarding resets force_forwarding on an interface, which previously happened silently.
---
iproute2 patch here:
https://lore.kernel.org/netdev/[email protected]/
Changes in v2:
- Emit when net.ipv6.conf.all.forwarding is disabled (thanks @Ido Schimmel)
- Rebase onto net-next
- Link to v1: https://lore.kernel.org/[email protected]
--- net/ipv6/addrconf.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +13 -1
@@ -529,6 +529,9 @@ static int inet6_netconf_msgsize_devconf(int type)if (all || type ==NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN ) size +=nla_total_size (4 ); +if (all || type ==NETCONFA_FORCE_FORWARDING ) + size +=nla_total_size (4 ); +return size; }
@@ -578,6 +581,11 @@ static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex, READ_ONCE(devconf->ignore_routes_with_linkdown)) < 0) goto nla_put_failure; +if ((all || type ==NETCONFA_FORCE_FORWARDING ) && +nla_put_s32 (skb,NETCONFA_FORCE_FORWARDING , +READ_ONCE (devconf->force_forwarding)) <0 ) + goto nla_put_failure; + out:nlmsg_end (skb, nlh);return 0 ;
@@ -863,8 +871,12 @@ static void addrconf_forward_change(struct net *net, __s32 newf)if (idev) {int changed = (!idev->cnf.forwarding) ^ (!newf);/* Disabling all.forwarding sets 0 to force_forwarding for all interfaces */ -if (newf ==0 ) +if (newf ==0 && idev->cnf.force_forwarding) {WRITE_ONCE (idev->cnf.force_forwarding,0 ); +inet6_netconf_notify_devconf (net,RTM_NEWNETCONF , +NETCONFA_FORCE_FORWARDING , + dev->ifindex, &idev->cnf); + }WRITE_ONCE (idev->cnf.forwarding, newf);if (changed)
---
base-commit: 7b6ab4dbc156e2f96419715130b3d5738a306c93
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git main
change-id: 20261023-ipv6_add_netconfa-b87b66b35272
Best regards,
Signature · 1 line
Gabriel Goller <[email protected]>
Quoted 10 lines · Gabriel Goller
Since
force_forwardingwas added, changing the sysctl sends anRTM_NEWNETCONFnotification of typeNETCONFA_FORCE_FORWARDING, butinet6_netconf_fill_devconf()never emits the attribute. Listeners only receiveNETCONFA_IFINDEXwithout the new value, andRTM_GETNETCONFreplies and dumps omit it as well.Also send a notification when disabling all.forwarding resets
force_forwardingon an interface, which previously happened silently.Fixes f24987ef6959 ("ipv6: add `force_forwarding` sysctl to enable per-interface forwarding")
Fixes tag on net-next is only valid when the blamed commit is only in net-next, but maybe Paolo / Jakub will agree to strip it, so wait with v3.
Quoted 1 line
Signed-off-by Gabriel Goller <[email protected]>
There's a report from Sashiko [1] about a pre-existing issue:
all.force_forwarding not being cleared when all.forwarding is cleared.
# ip link add name dummy1 type dummy # 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
[1] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/[email protected]
Paolo Abeni
maintainerQuoted 7 lines · Ido Schimmel
Quoted 6 lines · Gabriel Goller
Since
force_forwardingwas added, changing the sysctl sends anRTM_NEWNETCONFnotification of typeNETCONFA_FORCE_FORWARDING, butinet6_netconf_fill_devconf()never emits the attribute. Listeners only receiveNETCONFA_IFINDEXwithout the new value, andRTM_GETNETCONFreplies and dumps omit it as well.
Quoted 8 lines
Quoted 4 lines
Also send a notification when disabling all.forwarding resets
force_forwardingon an interface, which previously happened silently.Fixes f24987ef6959 ("ipv6: add `force_forwarding` sysctl to enable per-interface forwarding")Fixes tag on net-next is only valid when the blamed commit is only in net-next, but maybe Paolo / Jakub will agree to strip it, so wait with v3.
I agreed the tag should be stripped here, but just for completeness general guidance above is slightly changed again. Due to the incoming fixes influx we are redirecting actual, low prio, fixes from net to net-next, retaining the fixes tag.
Quoted 16 lines
Quoted 1 line
Signed-off-by Gabriel Goller <[email protected]>Reviewed-by Ido Schimmel <[email protected]>There's a report from Sashiko [1] about a pre-existing issue:
all.force_forwarding not being cleared when all.forwarding is cleared.# ip link add name dummy1 type dummy # 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
Thanks, I agree that is separate topic, again IMHO suitable for net-next.
/P
Quoted 32 lines · Ido Schimmel
Quoted 10 lines · Gabriel Goller
Since
force_forwardingwas added, changing the sysctl sends anRTM_NEWNETCONFnotification of typeNETCONFA_FORCE_FORWARDING, butinet6_netconf_fill_devconf()never emits the attribute. Listeners only receiveNETCONFA_IFINDEXwithout the new value, andRTM_GETNETCONFreplies and dumps omit it as well.Also send a notification when disabling all.forwarding resets
force_forwardingon an interface, which previously happened silently.Fixes f24987ef6959 ("ipv6: add `force_forwarding` sysctl to enable per-interface forwarding")Fixes tag on net-next is only valid when the blamed commit is only in net-next, but maybe Paolo / Jakub will agree to strip it, so wait with v3.
Quoted 1 line
Signed-off-by Gabriel Goller <[email protected]>Reviewed-by Ido Schimmel <[email protected]>There's a report from Sashiko [1] about a pre-existing issue:
all.force_forwarding not being cleared when all.forwarding is cleared.# ip link add name dummy1 type dummy # 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
Thanks, sent a patch:
https://lore.kernel.org/netdev/[email protected]/
Gabriel
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Wed, 04 Nov 2026 10:46:10 +0100 you wrote:
Since
force_forwardingwas added, changing the sysctl sends anRTM_NEWNETCONFnotification of typeNETCONFA_FORCE_FORWARDING, butinet6_netconf_fill_devconf()never emits the attribute. Listeners only receiveNETCONFA_IFINDEXwithout the new value, andRTM_GETNETCONFreplies and dumps omit it as well.Also send a notification when disabling all.forwarding resets
force_forwardingon an interface, which previously happened silently.[...]
Here is the summary with links:
- [net-next,v2] ipv6: Add NETCONFA_FORCE_FORWARDING to netconf messages
https://git.kernel.org/netdev/net-next/c/2d916a8c307c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html