diff options
| author | Roy Marples <roy@marples.name> | 2016-02-01 22:47:46 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2016-02-01 22:47:46 +0000 |
| commit | eeb3d111931a5b3e72638b5efecb054eb79549d2 (patch) | |
| tree | e09645489972a63e69ece0e61e501e9bbbe3271f /ipv6.c | |
| parent | 7ce7c86d7ecf006d4b71c215d2bea2e91f6d9271 (diff) | |
| download | dhcpcd-eeb3d111931a5b3e72638b5efecb054eb79549d2.tar.xz | |
Do the same for IPv6 as the prior patch.
Diffstat (limited to 'ipv6.c')
| -rw-r--r-- | ipv6.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -1090,6 +1090,39 @@ ipv6_iffindaddr(const struct interface *ifp, const struct in6_addr *addr) return NULL; } +static struct ipv6_addr * +ipv6_iffindmaskaddr(const struct interface *ifp, const struct in6_addr *addr) +{ + struct ipv6_state *state; + struct ipv6_addr *ap; + struct in6_addr mask; + + state = IPV6_STATE(ifp); + if (state) { + TAILQ_FOREACH(ap, &state->addrs, next) { + if (ipv6_mask(&mask, ap->prefix_len) == -1) + continue; + if (IN6_ARE_MASKED_ADDR_EQUAL(&ap->addr, addr, &mask)) + return ap; + } + } + return NULL; +} + +struct ipv6_addr * +ipv6_findmaskaddr(struct dhcpcd_ctx *ctx, const struct in6_addr *addr) +{ + struct interface *ifp; + struct ipv6_addr *ap; + + TAILQ_FOREACH(ifp, ctx->ifaces, next) { + ap = ipv6_iffindmaskaddr(ifp, addr); + if (ap != NULL) + return ap; + } + return NULL; +} + int ipv6_addlinklocalcallback(struct interface *ifp, void (*callback)(void *), void *arg) |
