From: Roy Marples Date: Fri, 4 Aug 2017 18:59:03 +0000 (+0100) Subject: More ap -> ia X-Git-Tag: v7.0.0-rc2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65ae27ee04295c6589cd64d2fd3bb78006110b05;p=thirdparty%2Fdhcpcd.git More ap -> ia --- diff --git a/src/dhcp6.c b/src/dhcp6.c index 7f75c351..337b135a 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -1340,34 +1340,34 @@ dhcp6_dadcompleted(const struct interface *ifp) static void dhcp6_dadcallback(void *arg) { - struct ipv6_addr *ap = arg; + struct ipv6_addr *ia = arg; struct interface *ifp; struct dhcp6_state *state; int wascompleted, valid; - wascompleted = (ap->flags & IPV6_AF_DADCOMPLETED); - ap->flags |= IPV6_AF_DADCOMPLETED; - if (ap->flags & IPV6_AF_DUPLICATED) + wascompleted = (ia->flags & IPV6_AF_DADCOMPLETED); + ia->flags |= IPV6_AF_DADCOMPLETED; + if (ia->flags & IPV6_AF_DUPLICATED) /* XXX FIXME * We should decline the address */ - logwarnx("%s: DAD detected %s", ap->iface->name, ap->saddr); + logwarnx("%s: DAD detected %s", ia->iface->name, ia->saddr); if (!wascompleted) { - ifp = ap->iface; + ifp = ia->iface; state = D6_STATE(ifp); if (state->state == DH6S_BOUND || state->state == DH6S_DELEGATED) { - struct ipv6_addr *ap2; + struct ipv6_addr *ia2; #ifdef SMALL valid = true; #else - valid = (ap->delegating_prefix == NULL); + valid = (ia->delegating_prefix == NULL); #endif - TAILQ_FOREACH(ap2, &state->addrs, next) { - if (ap2->flags & IPV6_AF_ADDED && - !(ap2->flags & IPV6_AF_DADCOMPLETED)) + TAILQ_FOREACH(ia2, &state->addrs, next) { + if (ia2->flags & IPV6_AF_ADDED && + !(ia2->flags & IPV6_AF_DADCOMPLETED)) { wascompleted = 1; break; @@ -1378,7 +1378,7 @@ dhcp6_dadcallback(void *arg) ifp->name); script_runreason(ifp, #ifndef SMALL - ap->delegating_prefix ? "DELEGATED6" : + ia->delegating_prefix ? "DELEGATED6" : #endif state->reason); if (valid) diff --git a/src/ipv6.c b/src/ipv6.c index e94a1253..61e5f23b 100644 --- a/src/ipv6.c +++ b/src/ipv6.c @@ -955,23 +955,23 @@ ipv6_addaddrs(struct ipv6_addrhead *addrs) } void -ipv6_freeaddr(struct ipv6_addr *ap) +ipv6_freeaddr(struct ipv6_addr *ia) { #ifndef SMALL - struct ipv6_addr *ia; + struct ipv6_addr *iad; /* Forget the reference */ - if (ap->flags & IPV6_AF_DELEGATEDPFX) { - TAILQ_FOREACH(ia, &ap->pd_pfxs, pd_next) { - ia->delegating_prefix = NULL; + if (ia->flags & IPV6_AF_DELEGATEDPFX) { + TAILQ_FOREACH(iad, &ia->pd_pfxs, pd_next) { + iad->delegating_prefix = NULL; } - } else if (ap->delegating_prefix != NULL) { - TAILQ_REMOVE(&ap->delegating_prefix->pd_pfxs, ap, pd_next); + } else if (ia->delegating_prefix != NULL) { + TAILQ_REMOVE(&ia->delegating_prefix->pd_pfxs, ia, pd_next); } #endif - eloop_q_timeout_delete(ap->iface->ctx->eloop, 0, NULL, ap); - free(ap); + eloop_q_timeout_delete(ia->iface->ctx->eloop, 0, NULL, ia); + free(ia); } void diff --git a/src/ipv6nd.c b/src/ipv6nd.c index 15bd5999..cb683ca7 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -618,7 +618,7 @@ ipv6nd_dadcompleted(const struct interface *ifp) static void ipv6nd_dadcallback(void *arg) { - struct ipv6_addr *ap = arg, *rapap; + struct ipv6_addr *ia = arg, *rapap; struct interface *ifp; struct ra *rap; int wascompleted, found; @@ -627,54 +627,54 @@ ipv6nd_dadcallback(void *arg) const char *p; int dadcounter; - ifp = ap->iface; - wascompleted = (ap->flags & IPV6_AF_DADCOMPLETED); - ap->flags |= IPV6_AF_DADCOMPLETED; - if (ap->flags & IPV6_AF_DUPLICATED) { - ap->dadcounter++; - logwarnx("%s: DAD detected %s", ifp->name, ap->saddr); + ifp = ia->iface; + wascompleted = (ia->flags & IPV6_AF_DADCOMPLETED); + ia->flags |= IPV6_AF_DADCOMPLETED; + if (ia->flags & IPV6_AF_DUPLICATED) { + ia->dadcounter++; + logwarnx("%s: DAD detected %s", ifp->name, ia->saddr); /* Try and make another stable private address. * Because ap->dadcounter is always increamented, * a different address is generated. */ /* XXX Cache DAD counter per prefix/id/ssid? */ if (ifp->options->options & DHCPCD_SLAACPRIVATE) { - if (ap->dadcounter >= IDGEN_RETRIES) { + if (ia->dadcounter >= IDGEN_RETRIES) { logerrx("%s: unable to obtain a" " stable private address", ifp->name); goto try_script; } loginfox("%s: deleting address %s", - ifp->name, ap->saddr); - if (if_address6(RTM_DELADDR, ap) == -1 && + ifp->name, ia->saddr); + if (if_address6(RTM_DELADDR, ia) == -1 && errno != EADDRNOTAVAIL && errno != ENXIO) logerr(__func__); - dadcounter = ap->dadcounter; - if (ipv6_makestableprivate(&ap->addr, - &ap->prefix, ap->prefix_len, + dadcounter = ia->dadcounter; + if (ipv6_makestableprivate(&ia->addr, + &ia->prefix, ia->prefix_len, ifp, &dadcounter) == -1) { logerr("ipv6_makestableprivate"); return; } - ap->dadcounter = dadcounter; - ap->flags &= ~(IPV6_AF_ADDED | IPV6_AF_DADCOMPLETED); - ap->flags |= IPV6_AF_NEW; - p = inet_ntop(AF_INET6, &ap->addr, buf, sizeof(buf)); + ia->dadcounter = dadcounter; + ia->flags &= ~(IPV6_AF_ADDED | IPV6_AF_DADCOMPLETED); + ia->flags |= IPV6_AF_NEW; + p = inet_ntop(AF_INET6, &ia->addr, buf, sizeof(buf)); if (p) - snprintf(ap->saddr, - sizeof(ap->saddr), + snprintf(ia->saddr, + sizeof(ia->saddr), "%s/%d", - p, ap->prefix_len); + p, ia->prefix_len); else - ap->saddr[0] = '\0'; + ia->saddr[0] = '\0'; tv.tv_sec = 0; tv.tv_nsec = (suseconds_t) arc4random_uniform(IDGEN_DELAY * NSEC_PER_SEC); timespecnorm(&tv); eloop_timeout_add_tv(ifp->ctx->eloop, &tv, - ipv6nd_addaddr, ap); + ipv6nd_addaddr, ia); return; } } @@ -694,7 +694,7 @@ try_script: wascompleted = 0; break; } - if (rapap == ap) + if (rapap == ia) found = 1; }