if ((len = make_sock(ctx, &sun)) == -1)
return -1;
- return connect(ctx->control_fd, (struct sockaddr *)&sun, len);
+ if (connect(ctx->control_fd, (struct sockaddr *)&sun, len) == -1) {
+ close(ctx->control_fd);
+ ctx->control_fd = -1;
+ return -1;
+ }
+ return 0;
}
int
break;
}
}
- if (ifp == NULL) {
+ if (ifp == NULL && ctx->ipv6) {
if (ctx->ipv6->dhcp_fd != -1) {
eloop_event_delete(ctx->eloop, ctx->ipv6->dhcp_fd);
close(ctx->ipv6->dhcp_fd);
if (ctx.options & DHCPCD_STARTED && !(ctx.options & DHCPCD_FORKED))
syslog(LOG_INFO, "exited");
+ closelog();
return i;
}
{
const struct ra *rap;
- TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next)
- if (rap->iface == ifp)
- return 1;
+ if (ifp->ctx->ipv6) {
+ TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next)
+ if (rap->iface == ifp)
+ return 1;
+ }
return 0;
}
int expired = 0;
TAILQ_HEAD(rahead, ra) rtrs;
+ if (ifp->ctx->ipv6 == NULL)
+ return;
+
eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
TAILQ_INIT(&rtrs);
TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {