]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP6: IPV6_AF_DELEGATEDPFX -> IPV6_AF_PFXDELEGATION
authorRoy Marples <roy@marples.name>
Fri, 30 Aug 2024 14:09:17 +0000 (15:09 +0100)
committerRoy Marples <roy@marples.name>
Fri, 30 Aug 2024 14:09:17 +0000 (15:09 +0100)
This is easier to see the difference with IPV6_AF_DELEGAGTED.

src/dhcp6.c
src/ipv6.c
src/ipv6.h

index 3c7f156ecf93d31bd8637eae4a14d9375c6fc7cd..bda0ee8d1eb0297161a462b1fe26fe09f0cf5725 100644 (file)
@@ -1749,7 +1749,8 @@ dhcp6_fail(struct interface *ifp, bool drop)
        state->failed = true;
 
        if (drop) {
-               dhcp6_freedrop_addrs(ifp, 1, IPV6_AF_ANYDELEGATED, NULL);
+               dhcp6_freedrop_addrs(ifp, 1,
+                   IPV6_AF_DELEGATED | IPV6_AF_PFXDELEGATION, NULL);
 #ifndef SMALL
                dhcp6_delete_delegates(ifp);
 #endif
@@ -2274,7 +2275,7 @@ dhcp6_findpd(struct interface *ifp, const uint8_t *iaid,
 
                if (a == NULL) {
                        a = ipv6_newaddr(ifp, &pdp_prefix, pdp_plen,
-                           IPV6_AF_DELEGATEDPFX);
+                           IPV6_AF_PFXDELEGATION);
                        if (a == NULL)
                                break;
                        a->created = *acquired;
@@ -2283,8 +2284,8 @@ dhcp6_findpd(struct interface *ifp, const uint8_t *iaid,
                        memcpy(a->iaid, iaid, sizeof(a->iaid));
                        TAILQ_INSERT_TAIL(&state->addrs, a, next);
                } else {
-                       if (!(a->flags & IPV6_AF_DELEGATEDPFX))
-                               a->flags |= IPV6_AF_NEW | IPV6_AF_DELEGATEDPFX;
+                       if (!(a->flags & IPV6_AF_PFXDELEGATION))
+                               a->flags |= IPV6_AF_NEW | IPV6_AF_PFXDELEGATION;
                        a->flags &= ~(IPV6_AF_STALE | IPV6_AF_EXTENDED);
                        if (a->prefix_vltime != pdp_vltime)
                                a->flags |= IPV6_AF_NEW;
@@ -2552,7 +2553,7 @@ dhcp6_deprecateaddrs(struct ipv6_addrhead *addrs)
 #ifndef SMALL
                /* If we delegated from this prefix, deprecate or remove
                 * the delegations. */
-               if (ia->flags & IPV6_AF_DELEGATEDPFX)
+               if (ia->flags & IPV6_AF_PFXDELEGATION)
                        dhcp6_deprecatedele(ia);
 #endif
 
@@ -2927,7 +2928,7 @@ dhcp6_delegate_prefix(struct interface *ifp)
                k = 0;
                carrier_warned = false;
                TAILQ_FOREACH(ap, &state->addrs, next) {
-                       if (!(ap->flags & IPV6_AF_DELEGATEDPFX))
+                       if (!(ap->flags & IPV6_AF_PFXDELEGATION))
                                continue;
                        if (!(ap->flags & IPV6_AF_DELEGATEDLOG)) {
                                int loglevel;
@@ -3028,7 +3029,7 @@ dhcp6_find_delegates(struct interface *ifp)
                if (state == NULL || state->state != DH6S_BOUND)
                        continue;
                TAILQ_FOREACH(ap, &state->addrs, next) {
-                       if (!(ap->flags & IPV6_AF_DELEGATEDPFX))
+                       if (!(ap->flags & IPV6_AF_PFXDELEGATION))
                                continue;
                        for (i = 0; i < ifo->ia_len; i++) {
                                ia = &ifo->ia[i];
index 07b42c1e0e8271dcbac14ff6cd240a9865c4015a..d4db89379057a24406e536453fd564bee484d454 100644 (file)
@@ -960,7 +960,7 @@ ipv6_doaddr(struct ipv6_addr *ia, struct timespec *now)
 {
 
        /* A delegated prefix is not an address. */
-       if (ia->flags & IPV6_AF_DELEGATEDPFX)
+       if (ia->flags & IPV6_AF_PFXDELEGATION)
                return 0;
 
        if (ia->prefix_vltime == 0) {
@@ -1014,7 +1014,7 @@ ipv6_freeaddr(struct ipv6_addr *ia)
        struct ipv6_addr *iad;
 
        /* Forget the reference */
-       if (ia->flags & IPV6_AF_DELEGATEDPFX) {
+       if (ia->flags & IPV6_AF_PFXDELEGATION) {
                TAILQ_FOREACH(iad, &ia->pd_pfxs, pd_next) {
                        iad->delegating_prefix = NULL;
                }
@@ -1673,7 +1673,7 @@ ipv6_newaddr(struct interface *ifp, const struct in6_addr *addr,
 #else
                return ia;
 #endif
-       } else if (ia->flags & (IPV6_AF_REQUEST | IPV6_AF_DELEGATEDPFX)) {
+       } else if (ia->flags & (IPV6_AF_REQUEST | IPV6_AF_PFXDELEGATION)) {
                ia->prefix = *addr;
                cbp = inet_ntop(AF_INET6, &ia->prefix, buf, sizeof(buf));
                goto paddr;
@@ -2244,7 +2244,7 @@ inet6_makeprefix(struct interface *ifp, const struct ra *rap,
 
        /* This address is the delegated prefix, so add a reject route for
         * it via the loopback interface. */
-       if (addr->flags & IPV6_AF_DELEGATEDPFX) {
+       if (addr->flags & IPV6_AF_PFXDELEGATION) {
                struct interface *lo0;
 
                TAILQ_FOREACH(lo0, ifp->ctx->ifaces, next) {
@@ -2264,7 +2264,7 @@ inet6_makeprefix(struct interface *ifp, const struct ra *rap,
        sa_in6_init(&rt->rt_dest, &addr->prefix);
        ipv6_mask(&netmask, addr->prefix_len);
        sa_in6_init(&rt->rt_netmask, &netmask);
-       if (addr->flags & IPV6_AF_DELEGATEDPFX) {
+       if (addr->flags & IPV6_AF_PFXDELEGATION) {
                rt->rt_flags |= RTF_REJECT;
                /* Linux does not like a gateway for a reject route. */
 #ifndef __linux__
@@ -2406,7 +2406,7 @@ inet6_dhcproutes(rb_tree_t *routes, struct dhcpcd_ctx *ctx,
                TAILQ_FOREACH(ia, &d6_state->addrs, next) {
                        if (dstate == DH6S_DELEGATED) {
                                // Reject route won't have IPV6_AF_ADDED
-                               if (!(ia->flags & IPV6_AF_DELEGATEDPFX))
+                               if (!(ia->flags & IPV6_AF_PFXDELEGATION))
                                        continue;
                        } else if (!(ia->flags & IPV6_AF_ADDED))
                                continue;
index 8189e1e3d8fa0ec03883b756186831b39f122c39..a298985864f7a00819cb3ef45f12a4d0899cf69b 100644 (file)
@@ -217,8 +217,8 @@ struct ipv6_addr {
 #define        IPV6_AF_ADDED           (1U << 3)
 #define        IPV6_AF_AUTOCONF        (1U << 4)
 #define        IPV6_AF_DADCOMPLETED    (1U << 5)
-#define        IPV6_AF_DELEGATED       (1U << 6)       // Delegated from prefix
-#define        IPV6_AF_DELEGATEDPFX    (1U << 7)       // Delegated prefix
+#define        IPV6_AF_PFXDELEGATION   (1U << 6)
+#define        IPV6_AF_DELEGATED       (1U << 7)
 #define        IPV6_AF_NOREJECT        (1U << 8)
 #define        IPV6_AF_REQUEST         (1U << 9)
 #define        IPV6_AF_STATIC          (1U << 10)
@@ -231,8 +231,6 @@ struct ipv6_addr {
 #define        IPV6_AF_TEMPORARY       (1U << 16)
 #endif
 
-#define IPV6_AF_ANYDELEGATED   (IPV6_AF_DELEGATED | IPV6_AF_DELEGATEDPFX)
-
 struct ll_callback {
        TAILQ_ENTRY(ll_callback) next;
        void (*callback)(void *);