diff options
| author | Roy Marples <roy@marples.name> | 2014-06-04 23:54:15 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2014-06-04 23:54:15 +0000 |
| commit | d05215aa288607dbf55c879b00d2c0d115764644 (patch) | |
| tree | f71a13f35db72e8d7cc3dba082c183d8e0294aee /ipv6.c | |
| parent | 5c097200ef1daffe7f989b10f0120e97290cc173 (diff) | |
| download | dhcpcd-d05215aa288607dbf55c879b00d2c0d115764644.tar.xz | |
Add an IPv6 link-local address before upping the interface if needed.
Bring an interface up when we start it and not during discovery.
As such, stop waiting on carrier for a second if we did.
Diffstat (limited to 'ipv6.c')
| -rw-r--r-- | ipv6.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -31,6 +31,7 @@ #include <sys/stat.h> #include <net/route.h> +#include <netinet/if_ether.h> #include <netinet/in.h> #ifdef __linux__ @@ -917,7 +918,7 @@ ipv6_addlinklocal(struct interface *ifp) switch (ifp->family) { case ARPHRD_ETHER: /* Check for a valid hardware address */ - if (ifp->hwlen != 6 & ifp->hwlen != 8) { + if (ifp->hwlen != 6 && ifp->hwlen != 8) { errno = ENOTSUP; return -1; } @@ -988,8 +989,20 @@ ipv6_addlinklocal(struct interface *ifp) int ipv6_start(struct interface *ifp) { + const struct ipv6_state *state; + const struct ipv6_addr *ap; + + state = IPV6_CSTATE(ifp); + if (state) { + TAILQ_FOREACH(ap, &state->addrs, next) { + if (IN6_IS_ADDR_LINKLOCAL(&ap->addr) && + !(ap->addr_flags & IN6_IFF_DUPLICATED)) + break; + } + } else + ap = NULL; - if (ipv6_linklocal(ifp) == NULL && ipv6_addlinklocal(ifp) == -1) + if (ap == NULL && ipv6_addlinklocal(ifp) == -1) return -1; return 0; } |
