diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1319,7 +1319,7 @@ * nd6_prelist_add will install the corresponding * interface route. */ - if ((error = nd6_prelist_add(&pr0, NULL, &pr)) != 0) { + if ((error = nd6_prelist_add(&pr0, &pr)) != 0) { if (carp_attached) (*carp_detach_p)(&ia->ia_ifa, false); goto out; diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -625,7 +625,7 @@ * valid with referring to the old link-local address. */ if ((pr = nd6_prefix_lookup(&pr0)) == NULL) { - if ((error = nd6_prelist_add(&pr0, NULL, &pr)) != 0) + if ((error = nd6_prelist_add(&pr0, &pr)) != 0) return (error); /* Reference prefix */ ia->ia6_ndpr = pr; diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -402,8 +402,7 @@ void nd6_defrouter_purge(struct ifnet *); void nd6_defrouter_timer(void); void nd6_defrouter_init(void); -int nd6_prelist_add(struct nd_prefixctl *, struct nd_defrouter *, - struct nd_prefix **); +int nd6_prelist_add(struct nd_prefixctl *, struct nd_prefix **); void nd6_prefix_unlink(struct nd_prefix *, struct nd_prhead *); void nd6_prefix_del(struct nd_prefix *); void nd6_prefix_ref(struct nd_prefix *); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1400,8 +1400,7 @@ } int -nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr, - struct nd_prefix **newp) +nd6_prelist_add(struct nd_prefixctl *pr, struct nd_prefix **newp) { struct nd_prefix *new; char ip6buf[INET6_ADDRSTRLEN]; @@ -1448,8 +1447,6 @@ ND6_ONLINK_UNLOCK(); } - if (dr != NULL) - pfxrtr_add(new, dr); if (newp != NULL) *newp = new; return (0); @@ -1571,17 +1568,15 @@ NET_EPOCH_ASSERT(); /* check if prefix already exists on the same interface */ - if ((pr = nd6_prefix_lookup(new)) != NULL) { + if ((pr = nd6_prefix_lookup(new)) != NULL) nd6_prefix_update(new, pr); - if (dr != NULL) - pfxrtr_add(pr, dr); - } else { + else { if (new->ndpr_vltime == 0) goto end; if (new->ndpr_raf_onlink == 0 && new->ndpr_raf_auto == 0) goto end; - error = nd6_prelist_add(new, dr, &pr); + error = nd6_prelist_add(new, &pr); if (error != 0) { nd6log((LOG_NOTICE, "%s: nd6_prelist_add() failed for " "the prefix %s/%d on %s (errno=%d)\n", __func__, @@ -1603,6 +1598,8 @@ in6_init_prefix_ltimes(pr); } } + if (dr != NULL) + pfxrtr_add(pr, dr); /* * Address autoconfiguration based on Section 5.5.3 of RFC 2462.