On Mon, Nov 28, 2016 at 12:31:39PM +0100, Martin Pieuchot wrote: > This kill multiple recursive splsoftnet(), ok?
OK bluhm@ > > Index: netinet6/nd6.h > =================================================================== > RCS file: /cvs/src/sys/netinet6/nd6.h,v > retrieving revision 1.64 > diff -u -p -r1.64 nd6.h > --- netinet6/nd6.h 21 Nov 2016 10:52:08 -0000 1.64 > +++ netinet6/nd6.h 28 Nov 2016 11:19:49 -0000 > @@ -288,13 +288,10 @@ void nd6_rs_detach(struct ifnet *); > void nd6_rs_input(struct mbuf *, int, int); > > void prelist_del(struct nd_prefix *); > -void defrouter_addreq(struct nd_defrouter *); > void defrouter_reset(void); > void defrouter_select(void); > void defrtrlist_del(struct nd_defrouter *); > void prelist_remove(struct nd_prefix *); > -int nd6_prelist_add(struct nd_prefix *, struct nd_defrouter *, > - struct nd_prefix **); > void pfxlist_onlink_check(void); > struct nd_defrouter *defrouter_lookup(struct in6_addr *, unsigned int); > > Index: netinet6/nd6_rtr.c > =================================================================== > RCS file: /cvs/src/sys/netinet6/nd6_rtr.c,v > retrieving revision 1.151 > diff -u -p -r1.151 nd6_rtr.c > --- netinet6/nd6_rtr.c 21 Nov 2016 10:56:26 -0000 1.151 > +++ netinet6/nd6_rtr.c 28 Nov 2016 11:25:24 -0000 > @@ -70,6 +70,9 @@ int nd6_prefix_onlink(struct nd_prefix * > int nd6_prefix_offlink(struct nd_prefix *); > void in6_init_address_ltimes(struct nd_prefix *, struct in6_addrlifetime *); > int prelist_update(struct nd_prefix *, struct nd_defrouter *, struct mbuf *); > +int nd6_prelist_add(struct nd_prefix *, struct nd_defrouter *, > + struct nd_prefix **); > +void defrouter_addreq(struct nd_defrouter *); > int rt6_deleteroute(struct rtentry *, void *, unsigned int); > > void nd6_addr_add(void *); > @@ -578,7 +581,6 @@ defrouter_addreq(struct nd_defrouter *ne > struct rt_addrinfo info; > struct sockaddr_in6 def, mask, gate; > struct rtentry *rt; > - int s; > int error; > > memset(&def, 0, sizeof(def)); > @@ -597,7 +599,6 @@ defrouter_addreq(struct nd_defrouter *ne > info.rti_info[RTAX_GATEWAY] = sin6tosa(&gate); > info.rti_info[RTAX_NETMASK] = sin6tosa(&mask); > > - s = splsoftnet(); > error = rtrequest(RTM_ADD, &info, RTP_DEFAULT, &rt, > new->ifp->if_rdomain); > if (error == 0) { > @@ -605,8 +606,6 @@ defrouter_addreq(struct nd_defrouter *ne > rtfree(rt); > new->installed = 1; > } > - splx(s); > - return; > } > > struct nd_defrouter * > @@ -663,7 +662,7 @@ defrtrlist_del(struct nd_defrouter *dr) > > ext->ndefrouters--; > if (ext->ndefrouters < 0) { > - log(LOG_WARNING, "defrtrlist_del: negative count on %s\n", > + log(LOG_WARNING, "%s: negative count on %s\n", __func__, > dr->ifp->if_xname); > } > > @@ -758,14 +757,12 @@ defrouter_select(void) > struct nd_defrouter *dr, *selected_dr = NULL, *installed_dr = NULL; > struct rtentry *rt = NULL; > struct llinfo_nd6 *ln = NULL; > - int s = splsoftnet(); > > /* > * Let's handle easy case (3) first: > * If default router list is empty, there's nothing to be done. > */ > if (TAILQ_EMPTY(&nd_defrouter)) { > - splx(s); > return; > } > > @@ -830,9 +827,6 @@ defrouter_select(void) > defrouter_delreq(installed_dr); > defrouter_addreq(selected_dr); > } > - > - splx(s); > - return; > } > > /* > @@ -1049,14 +1043,14 @@ nd6_prelist_add(struct nd_prefix *pr, st > struct nd_prefix **newp) > { > struct nd_prefix *new = NULL; > - int i, s; > struct in6_ifextra *ext = pr->ndpr_ifp->if_afdata[AF_INET6]; > + int i; > + > + splsoftassert(IPL_SOFTNET); > > if (ip6_maxifprefixes >= 0) { > if (ext->nprefixes >= ip6_maxifprefixes / 2) { > - s = splsoftnet(); > purge_detached(pr->ndpr_ifp); > - splx(s); > } > if (ext->nprefixes >= ip6_maxifprefixes) > return(ENOMEM); > @@ -1079,7 +1073,6 @@ nd6_prelist_add(struct nd_prefix *pr, st > > task_set(&new->ndpr_task, nd6_addr_add, new); > > - s = splsoftnet(); > /* link ndpr_entry to nd_prefix list */ > LIST_INSERT_HEAD(&nd_prefix, new, ndpr_entry); > > @@ -1089,8 +1082,8 @@ nd6_prelist_add(struct nd_prefix *pr, st > int e; > > if ((e = nd6_prefix_onlink(new)) != 0) { > - nd6log((LOG_ERR, "nd6_prelist_add: failed to make " > - "the prefix %s/%d on-link on %s (errno=%d)\n", > + nd6log((LOG_ERR, "%s: failed to make the prefix %s/%d" > + " on-link on %s (errno=%d)\n", __func__, > inet_ntop(AF_INET6, &pr->ndpr_prefix.sin6_addr, > addr, sizeof(addr)), > pr->ndpr_plen, pr->ndpr_ifp->if_xname, e)); > @@ -1100,7 +1093,6 @@ nd6_prelist_add(struct nd_prefix *pr, st > > if (dr) > pfxrtr_add(new, dr); > - splx(s); > > ext->nprefixes++; >