mirror of
https://github.com/rsmarples/dhcpcd.git
synced 2024-11-27 03:54:56 +08:00
DHCP6: IPV6_AF_DELEGATEDPFX -> IPV6_AF_PFXDELEGATION
This is easier to see the difference with IPV6_AF_DELEGAGTED.
This commit is contained in:
parent
88a93ff274
commit
a2821d8f6a
15
src/dhcp6.c
15
src/dhcp6.c
@ -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];
|
||||
|
12
src/ipv6.c
12
src/ipv6.c
@ -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;
|
||||
|
@ -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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user