From: kn Date: Wed, 23 Nov 2022 16:57:37 +0000 (+0000) Subject: Let nd6_if{at,de}tach() be void and take an ifp argument X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4d7e99f85f63e514aaa7deab536690e268699f12;p=openbsd Let nd6_if{at,de}tach() be void and take an ifp argument Do it like the rest of at/detach routines which modify a struct ifnet pointer without returning anything. OK mvs --- diff --git a/sys/net/if.c b/sys/net/if.c index 70f873b447d..e805f21c42f 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.682 2022/11/23 14:50:59 kn Exp $ */ +/* $OpenBSD: if.c,v 1.683 2022/11/23 16:57:37 kn Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -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..41cf2264e6a 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.251 2022/11/23 08:05:49 kn Exp $ */ +/* $OpenBSD: nd6.c,v 1.252 2022/11/23 16:57:37 kn Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -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; free(nd, M_IP6NDP, sizeof(*nd)); } diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 39c2fb384c0..8322630842c 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.h,v 1.84 2022/11/23 14:48:28 kn Exp $ */ +/* $OpenBSD: nd6.h,v 1.85 2022/11/23 16:57:37 kn Exp $ */ /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* @@ -152,8 +152,8 @@ union nd_opts { #define nd_opts_done nd_opt_each.done void nd6_init(void); -struct nd_ifinfo *nd6_ifattach(struct ifnet *); -void nd6_ifdetach(struct nd_ifinfo *); +void nd6_ifattach(struct ifnet *); +void nd6_ifdetach(struct ifnet *); int nd6_is_addr_neighbor(const struct sockaddr_in6 *, struct ifnet *); void nd6_option_init(void *, int, union nd_opts *); struct nd_opt_hdr *nd6_option(union nd_opts *);