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;
ifp->name);
script_runreason(ifp,
#ifndef SMALL
- ap->delegating_prefix ? "DELEGATED6" :
+ ia->delegating_prefix ? "DELEGATED6" :
#endif
state->reason);
if (valid)
}
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
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;
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;
}
}
wascompleted = 0;
break;
}
- if (rapap == ap)
+ if (rapap == ia)
found = 1;
}