* [PATCH net v2] ipv6: addrconf: regenerate missing host route on RTM_NEWADDR
[not found] <20261118062828.840641-1-847807867@qq.com>
@ 2026-11-18 6:30 ` Shuai Liu
2026-11-18 9:49 ` Ido Schimmel
0 siblings, 1 reply; 3+ messages in thread
From: Shuai Liu @ 2026-11-18 6:30 UTC (permalink / raw)
To: netdev
Cc: dsahern, idosch, edumazet, davem, kuba, pabeni, horms,
syzbot+af16ddc8fd22a1d135f8
When an interface MTU drops below IPV6_MIN_MTU, addrconf_notify()
stops IPv6 on the interface via addrconf_ifdown(). With
keep_addr_on_down enabled, permanent addresses are kept but their
host routes are deleted and ifp->rt is cleared; recovery is expected
to happen when the device is brought up, where the NETDEV_UP path
runs addrconf_permanent_addr().
That recovery never happens when IPv6 is stopped through the
NETDEV_CHANGEMTU path: the device itself never goes down, so no
NETDEV_UP event follows when the MTU is restored. The address is
left with ifp->rt == NULL while the device is up, and every later
RTM_NEWADDR notification only warns:
BUG: Address ::ffff:127.0.0.1 on device lo is missing its host route.
syzbot hit this by flapping lo's MTU across IPV6_MIN_MTU with
keep_addr_on_down set and toggling IFF_NOARP, which restarts DAD;
DAD is skipped on the loopback device, so DAD completion and the
warning repeat on every toggle and the address stays permanently
without its host route.
Instead of only warning, regenerate the host route with
fixup_permanent_addr() when RTM_NEWADDR arrives for an address
without ifp->rt on an up device, keeping the warning only for the
allocation failure case.
Fixes: 2d819d250a13 ("ipv6: Handle missing host route in __ipv6_ifa_notify")
Reported-by: syzbot+af16ddc8fd22a1d135f8@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=af16ddc8fd22a1d135f8
Signed-off-by: Shuai Liu <847807867@qq.com>
---
Changes since v1:
- Correct the subject prefix to target the net tree.
net/ipv6/addrconf.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 4b0cb7d23541d..70230ffdc077f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6357,17 +6357,17 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
/*
* If the address was optimistic we inserted the route at the
* start of our DAD process, so we don't need to do it again.
- * If the device was taken down in the middle of the DAD
- * cycle there is a race where we could get here without a
- * host route, so nothing to insert. That will be fixed when
- * the device is brought up.
+ * Otherwise, if the host route is gone while the device is up
+ * (e.g. dropped by addrconf_ifdown() for a low MTU and the
+ * address kept by keep_addr_on_down), regenerate it.
*/
- if (ifp->rt && !rcu_access_pointer(ifp->rt->fib6_node)) {
- ip6_ins_rt(net, ifp->rt);
- } else if (!ifp->rt && (ifp->idev->dev->flags & IFF_UP)) {
- pr_warn("BUG: Address %pI6c on device %s is missing its host route.\n",
- &ifp->addr, ifp->idev->dev->name);
+ if (!ifp->rt && (ifp->idev->dev->flags & IFF_UP)) {
+ if (fixup_permanent_addr(net, ifp->idev, ifp))
+ pr_warn("BUG: Address %pI6c on device %s is missing its host route.\n",
+ &ifp->addr, ifp->idev->dev->name);
}
+ if (ifp->rt && !rcu_access_pointer(ifp->rt->fib6_node))
+ ip6_ins_rt(net, ifp->rt);
if (ifp->idev->cnf.forwarding)
addrconf_join_anycast(ifp);
base-commit: 7cfbf79c66c63e807ea452abf0546e6f6d6833a6
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] ipv6: addrconf: regenerate missing host route on RTM_NEWADDR
2026-11-18 6:30 ` [PATCH net v2] ipv6: addrconf: regenerate missing host route on RTM_NEWADDR Shuai Liu
@ 2026-11-18 9:49 ` Ido Schimmel
2026-11-18 9:59 ` Shuai Liu
0 siblings, 1 reply; 3+ messages in thread
From: Ido Schimmel @ 2026-11-18 9:49 UTC (permalink / raw)
To: Shuai Liu
Cc: netdev, dsahern, edumazet, davem, kuba, pabeni, horms,
syzbot+af16ddc8fd22a1d135f8
On Wed, Nov 18, 2026 at 02:30:00PM +0800, Shuai Liu wrote:
> When an interface MTU drops below IPV6_MIN_MTU, addrconf_notify()
> stops IPv6 on the interface via addrconf_ifdown(). With
> keep_addr_on_down enabled, permanent addresses are kept but their
> host routes are deleted and ifp->rt is cleared; recovery is expected
> to happen when the device is brought up, where the NETDEV_UP path
> runs addrconf_permanent_addr().
This is only true for the loopback device. Other devices lose their
addresses regardless of keep_addr_on_down.
>
> That recovery never happens when IPv6 is stopped through the
> NETDEV_CHANGEMTU path: the device itself never goes down, so no
> NETDEV_UP event follows when the MTU is restored. The address is
> left with ifp->rt == NULL while the device is up, and every later
> RTM_NEWADDR notification only warns:
>
> BUG: Address ::ffff:127.0.0.1 on device lo is missing its host route.
>
> syzbot hit this by flapping lo's MTU across IPV6_MIN_MTU with
> keep_addr_on_down set and toggling IFF_NOARP, which restarts DAD;
> DAD is skipped on the loopback device, so DAD completion and the
> warning repeat on every toggle and the address stays permanently
> without its host route.
>
> Instead of only warning, regenerate the host route with
> fixup_permanent_addr() when RTM_NEWADDR arrives for an address
> without ifp->rt on an up device, keeping the warning only for the
> allocation failure case.
The better solution is to avoid getting into this state in the first
place by aligning the loopback device with other devices and flushing
its addresses when the MTU goes below the minimum.
Already discussed here:
https://lore.kernel.org/netdev/20260909115655.GA1344764@shredder/
I will post my patch next week.
And please read:
https://docs.kernel.org/next/process/maintainer-netdev.html
"don’t repost your patches within one 24h period".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] ipv6: addrconf: regenerate missing host route on RTM_NEWADDR
2026-11-18 9:49 ` Ido Schimmel
@ 2026-11-18 9:59 ` Shuai Liu
0 siblings, 0 replies; 3+ messages in thread
From: Shuai Liu @ 2026-11-18 9:59 UTC (permalink / raw)
To: idosch
Cc: netdev, dsahern, edumazet, davem, kuba, pabeni, horms,
syzbot+af16ddc8fd22a1d135f8
Hi Ido,
Thanks for the quick review and for pointing me to the September
discussion.
You're right on both counts: the "recovery on NETDEV_UP" reasoning only
holds for the loopback device, and preventing the state (flushing lo's
addresses when the MTU drops below the minimum) is cleaner than
repairing it at RTM_NEWADDR time.
Please consider my patch dropped. I'll look forward to your fix and
will test the syzbot reproducer against it.
Also, apologies for reposting v2 two minutes after v1 -- I've now read
maintainer-netdev.html and won't repost within a 24h period again.
Best regards,
Shuai Liu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-18 9:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261118062828.840641-1-847807867@qq.com>
2026-11-18 6:30 ` [PATCH net v2] ipv6: addrconf: regenerate missing host route on RTM_NEWADDR Shuai Liu
2026-11-18 9:49 ` Ido Schimmel
2026-11-18 9:59 ` Shuai Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox