nd6: Break pfxrtr_add out of nd6_prelist_add
Updating defrouter only required by `prelist_update()`. since `nd6_prelist_add()` is a public function, exclude unsed dr logic from it. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D56131
This commit is contained in:
+1
-1
@@ -1319,7 +1319,7 @@ in6_addifaddr(struct ifnet *ifp, struct in6_aliasreq *ifra, struct in6_ifaddr *i
|
||||
* 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;
|
||||
|
||||
@@ -625,7 +625,7 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp)
|
||||
* 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;
|
||||
|
||||
+1
-2
@@ -402,8 +402,7 @@ void nd6_defrouter_flush_all(void);
|
||||
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 *);
|
||||
|
||||
@@ -1400,8 +1400,7 @@ nd6_prefix_rele(struct nd_prefix *pr)
|
||||
}
|
||||
|
||||
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_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr,
|
||||
ND6_ONLINK_UNLOCK();
|
||||
}
|
||||
|
||||
if (dr != NULL)
|
||||
pfxrtr_add(new, dr);
|
||||
if (newp != NULL)
|
||||
*newp = new;
|
||||
return (0);
|
||||
@@ -1571,17 +1568,15 @@ prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr,
|
||||
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 @@ prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr,
|
||||
in6_init_prefix_ltimes(pr);
|
||||
}
|
||||
}
|
||||
if (dr != NULL)
|
||||
pfxrtr_add(pr, dr);
|
||||
|
||||
/*
|
||||
* Address autoconfiguration based on Section 5.5.3 of RFC 2462.
|
||||
|
||||
Reference in New Issue
Block a user