More rdomain checks are needed to be able to use the same subnet
in a back to back connection between IPv6 rdomains as pointed out
by mpi@.

OK?

diff --git sys/netinet6/nd6.c sys/netinet6/nd6.c
index 9616187..d704cd6 100644
--- sys/netinet6/nd6.c
+++ sys/netinet6/nd6.c
@@ -1264,10 +1264,13 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
                s = splsoftnet();
                /* First purge the addresses referenced by a prefix. */
                LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, npr) {
                        struct in6_ifaddr *ia6, *ia6_next;
 
+                       if (pr->ndpr_ifp->if_rdomain != ifp->if_rdomain)
+                               continue;
+
                        if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
                                continue; /* XXX */
 
                        /* do we really have to remove addresses as well? */
                        TAILQ_FOREACH_SAFE(ia6, &in6_ifaddr, ia_list, ia6_next) 
{
@@ -1282,10 +1285,13 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
                 * Purging the addresses might remove the prefix as well.
                 * So run the loop again to access only prefixes that have
                 * not been freed already.
                 */
                LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, npr) {
+                       if (pr->ndpr_ifp->if_rdomain != ifp->if_rdomain)
+                               continue;
+
                        if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
                                continue; /* XXX */
 
                        prelist_remove(pr);
                }
diff --git sys/netinet6/nd6_rtr.c sys/netinet6/nd6_rtr.c
index bfc9c9f..e46b3b4 100644
--- sys/netinet6/nd6_rtr.c
+++ sys/netinet6/nd6_rtr.c
@@ -1690,10 +1690,13 @@ nd6_prefix_onlink(struct nd_prefix *pr)
         * interface, and the prefix has already installed the interface route.
         * Although such a configuration is expected to be rare, we explicitly
         * allow it.
         */
        LIST_FOREACH(opr, &nd_prefix, ndpr_entry) {
+               if (opr->ndpr_ifp->if_rdomain != ifp->if_rdomain)
+                       continue;
+
                if (opr == pr)
                        continue;
 
                if ((opr->ndpr_stateflags & NDPRF_ONLINK) == 0)
                        continue;
@@ -1826,10 +1829,13 @@ nd6_prefix_offlink(struct nd_prefix *pr)
                 * the interface route (see comments in nd6_prefix_onlink).
                 * If there's one, try to make the prefix on-link on the
                 * interface.
                 */
                LIST_FOREACH(opr, &nd_prefix, ndpr_entry) {
+                       if (opr->ndpr_ifp->if_rdomain != ifp->if_rdomain)
+                               continue;
+
                        if (opr == pr)
                                continue;
 
                        if ((opr->ndpr_stateflags & NDPRF_ONLINK) != 0)
                                continue;

Reply via email to