len++;
if (IPV4LL_STATE_RUNNING(ifp))
len++;
+ if (IPV6_STATE_RUNNING(ifp))
+ len++;
if (RS_STATE_RUNNING(ifp))
len++;
if (D6_STATE_RUNNING(ifp))
return n;
}
+int
+ipv6_staticdadcompleted(const struct interface *ifp)
+{
+ const struct ipv6_state *state;
+ const struct ipv6_addr *ia;
+ int n;
+
+ if ((state = IPV6_CSTATE(ifp)) == NULL)
+ return 0;
+ n = 0;
+#define COMPLETED (IPV6_AF_STATIC | IPV6_AF_ADDED | IPV6_AF_DADCOMPLETED)
+ TAILQ_FOREACH(ia, &state->addrs, next) {
+ if ((ia->flags & COMPLETED) == COMPLETED &&
+ !(ia->addr_flags & IN6_IFF_NOTUSEABLE))
+ n++;
+ }
+ return n;
+}
+
int
ipv6_startstatic(struct interface *ifp)
{
((struct ipv6_state *)(ifp)->if_data[IF_DATA_IPV6])
#define IPV6_CSTATE(ifp) \
((const struct ipv6_state *)(ifp)->if_data[IF_DATA_IPV6])
+#define IPV6_STATE_RUNNING(ifp) ipv6_staticdadcompleted((ifp))
/* dhcpcd requires CMSG_SPACE to evaluate to a compile time constant. */
#ifdef __QNX__
#endif
int ipv6_start(struct interface *);
+int ipv6_staticdadcompleted(const struct interface *);
int ipv6_startstatic(struct interface *);
ssize_t ipv6_env(char **, const char *, const struct interface *);
void ipv6_ctxfree(struct dhcpcd_ctx *);
#define ipv6_init(a) (NULL)
#define ipv6_start(a) (-1)
#define ipv6_startstatic(a)
+#define ipv6_staticdadcompleted(a) (0)
#define ipv6_hasaddr(a) (0)
#define ipv6_free_ll_callbacks(a) {}
#define ipv6_free(a) {}
{
env[9] = strdup("if_up=false");
env[10] = strdup("if_down=false");
-#ifdef INET6
- } else if (strcmp(reason, "STATIC6") == 0) {
- /* For the time being, a static IPv6 address is does not qualify
- * the interface to be up.
- * Should we consider the presence of a static DNS server? */
- env[9] = strdup("if_up=false");
- env[10] = strdup("if_down=false");
-#endif
} else if (1 == 2 /* appease ifdefs */
#ifdef INET
|| (dhcp && state && state->new)
|| (ipv4ll && IPV4LL_STATE_RUNNING(ifp))
#endif
#ifdef INET6
+ || (static6 && IPV6_STATE_RUNNING(ifp))
|| (dhcp6 && d6_state && d6_state->new)
|| (ra && ipv6nd_hasra(ifp))
#endif
#endif
#ifdef INET6
+ if (IPV6_STATE_RUNNING(ifp)) {
+ if (send_interface1(fd, ifp, "STATIC6") == -1)
+ retval = -1;
+ }
if (RS_STATE_RUNNING(ifp)) {
if (send_interface1(fd, ifp, "ROUTERADVERT") == -1)
retval = -1;