diff options
| author | Roy Marples <roy@marples.name> | 2014-10-09 18:59:30 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2014-10-09 18:59:30 +0000 |
| commit | f30470407c46975440dee1b524ef01d798ae9274 (patch) | |
| tree | 17912fb90ff65fdbfb89d4b6a1f16bf9e8e336b9 /ipv6nd.c | |
| parent | 3446ccb56bc6fedba78161e2fa94cf88f9cfbdb8 (diff) | |
| download | dhcpcd-f30470407c46975440dee1b524ef01d798ae9274.tar.xz | |
Allow the same IP address to be leased for different interfaces.
The interface with the lowest metric gets the address.
When that interfaces loses the address, the next valid interface with the
lowest metric gets it.
Diffstat (limited to 'ipv6nd.c')
| -rw-r--r-- | ipv6nd.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -391,14 +391,15 @@ ipv6nd_free_opts(struct ra *rap) } } -int -ipv6nd_addrexists(struct dhcpcd_ctx *ctx, const struct ipv6_addr *addr) +struct ipv6_addr * +ipv6nd_findaddr(struct dhcpcd_ctx *ctx, const struct in6_addr *addr, + short flags) { struct ra *rap; struct ipv6_addr *ap; if (ctx->ipv6 == NULL) - return 0; + return NULL; TAILQ_FOREACH(rap, ctx->ipv6->ra_routers, next) { TAILQ_FOREACH(ap, &rap->addrs, next) { @@ -406,12 +407,14 @@ ipv6nd_addrexists(struct dhcpcd_ctx *ctx, const struct ipv6_addr *addr) if ((ap->flags & (IPV6_AF_ADDED | IPV6_AF_DADCOMPLETED)) == (IPV6_AF_ADDED | IPV6_AF_DADCOMPLETED)) - return 1; - } else if (IN6_ARE_ADDR_EQUAL(&ap->addr, &addr->addr)) - return 1; + return ap; + } else if (ap->prefix_vltime && + IN6_ARE_ADDR_EQUAL(&ap->addr, addr) && + (!flags || ap->flags & flags)) + return ap; } } - return 0; + return NULL; } void ipv6nd_freedrop_ra(struct ra *rap, int drop) @@ -525,7 +528,7 @@ ipv6nd_scriptrun(struct ra *rap) { hasaddress = 1; if (!(ap->flags & IPV6_AF_DADCOMPLETED) && - ipv6_findaddr(ap->iface, &ap->addr)) + ipv6_iffindaddr(ap->iface, &ap->addr)) ap->flags |= IPV6_AF_DADCOMPLETED; if ((ap->flags & IPV6_AF_DADCOMPLETED) == 0) { syslog(LOG_DEBUG, |
