> On 24 Nov 2022, at 00:47, Claudio Jeker <cje...@diehard.n-r-g.com> wrote: > > On Wed, Nov 23, 2022 at 02:54:08PM +0000, Klemens Nanni wrote: >> Do it like the rest of at/detach routines which modify a struct ifnet >> pointer without returning anything. >> >> OK? >> >> diff --git a/sys/net/if.c b/sys/net/if.c >> index c30d7e30e4f..3cb8bbf9176 100644 >> --- a/sys/net/if.c >> +++ b/sys/net/if.c >> @@ -460,7 +460,7 @@ if_attachsetup(struct ifnet *ifp) >> if_addgroup(ifp, IFG_ALL); >> >> #ifdef INET6 >> - ifp->if_nd = nd6_ifattach(ifp); >> + nd6_ifattach(ifp); >> #endif >> >> #if NPF > 0 >> @@ -1105,7 +1105,7 @@ if_detach(struct ifnet *ifp) >> KASSERT(TAILQ_EMPTY(&ifp->if_detachhooks)); >> >> #ifdef INET6 >> - nd6_ifdetach(ifp->if_nd); >> + nd6_ifdetach(ifp); >> #endif >> >> /* Announce that the interface is gone. */ >> diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c >> index 97c3536be9d..1924c36c813 100644 >> --- a/sys/netinet6/nd6.c >> +++ b/sys/netinet6/nd6.c >> @@ -126,7 +126,7 @@ nd6_init(void) >> timeout_set(&nd6_expire_timeout, nd6_expire_timer, NULL); >> } >> >> -struct nd_ifinfo * >> +void >> nd6_ifattach(struct ifnet *ifp) >> { >> struct nd_ifinfo *nd; >> @@ -139,12 +139,13 @@ nd6_ifattach(struct ifnet *ifp) >> nd->reachable = ND_COMPUTE_RTIME(nd->basereachable); >> nd->retrans = RETRANS_TIMER; >> >> - return nd; >> + ifp->if_nd = nd; >> } >> >> void >> -nd6_ifdetach(struct nd_ifinfo *nd) >> +nd6_ifdetach(struct ifnet *ifp) >> { >> + struct nd_ifinfo *nd = ifp->if_nd; >> > > Would it make sense to set ifp->if_nd = NULL; here?
The interface is unlinked from everywhere when we call nd6_ifdetach().