"Push kernel lock into in6_ioctl()" on tech@ talks about ND6 locking, here is one cleanup and one documentation change (squashed) for this.
--- Remove struct nd_ifinfo's unused .initialized member Added/set in 2002 nd6.h r1.17/nd6.c r1.42, respectively, but never read: attach nd_ifinfo structure to if_afdata. split IPv6 MTU (advertised by RA) from real link MTU. sync with kame Outside of _KERNEL, but nothing in base uses it, either. === Document struct nd_ifinfo protection, remove unused initialized member IPv6 Neighbour Discovery information is fully protected by the net lock. All access to struct ifnet's member *if_nd is read-only, with the one write exception being nd6_slowtimo() updating ND information. The output of `grep -srw -e if_nd -e nd6if /sys/' shows these and fits on a screen, probably with enough -C context to show locking details. --- Feedback? Objection? OK? diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index d6ccfd3a272..df9b25f3c39 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -133,8 +133,6 @@ nd6_ifattach(struct ifnet *ifp) nd = malloc(sizeof(*nd), M_IP6NDP, M_WAITOK | M_ZERO); - nd->initialized = 1; - nd->basereachable = REACHABLE_TIME; nd->reachable = ND_COMPUTE_RTIME(nd->basereachable); nd->retrans = RETRANS_TIMER; diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 52c1e31da78..ff80d75a351 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -43,12 +43,16 @@ #define ND6_LLINFO_DELAY 3 #define ND6_LLINFO_PROBE 4 +/* + * Locks used to protect struct members in this file: + * N net lock + */ + struct nd_ifinfo { - u_int32_t basereachable; /* BaseReachableTime */ - u_int32_t reachable; /* Reachable Time */ - u_int32_t retrans; /* Retrans Timer */ - int recalctm; /* BaseReacable re-calculation timer */ - u_int8_t initialized; /* Flag to see the entry is initialized */ + u_int32_t basereachable; /* [N] BaseReachableTime */ + u_int32_t reachable; /* [N] Reachable Time */ + u_int32_t retrans; /* [N] Retrans Timer */ + int recalctm; /* [N] BaseReachable recalc timer */ }; struct in6_nbrinfo {