obtained a local link address to send an RS.
If this happens, we should process the RA.
dhcp6_handleifa(cmd, ifname, addr, flags);
}
-int
-ipv6_interfacehaslinklocal(const struct interface *ifp)
+const struct ll_addr *
+ipv6_linklocal(const struct interface *ifp)
{
const struct ipv6_state *state;
state = IPV6_CSTATE(ifp);
- return (state && TAILQ_FIRST(&state->ll_addrs)) ? 1 : 0;
+ if (state)
+ return TAILQ_FIRST(&state->ll_addrs);
+ return NULL;
}
int ipv6_addlinklocalcallback(struct interface *ifp,
const char *, const struct in6_addr *, int);
int ipv6_handleifa_addrs(int, struct ipv6_addrhead *,
const struct in6_addr *, int);
-int ipv6_interfacehaslinklocal(const struct interface *);
+const struct ll_addr *ipv6_linklocal(const struct interface *);
int ipv6_addlinklocalcallback(struct interface *, void (*)(void *), void *);
void ipv6_free(struct interface *);
int ipv6_removesubnet(const struct interface *, struct ipv6_addr *);
if (ap->dadcallback == NULL)
syslog(LOG_WARNING, "%s: no callback!", ap->iface->name);
#endif
- if (sendmsg(unspec_sock, &sndhdr, 0) == -1)
+ if (sendmsg(unspec_sock, &sndhdr, 0) == -1) {
syslog(LOG_ERR, "%s: %s: sendmsg: %m",
ap->iface->name, __func__);
+ return;
+ }
if (ap->dadcallback) {
ms_to_tv(&tv, RETRANS_TIMER);
syslog(LOG_INFO, "%s: sending IPv6 NS for %s",
rap->iface->name, rap->sfrom);
#endif
- if (sendmsg(sock, &sndhdr, 0) == -1)
+ if (sendmsg(sock, &sndhdr, 0) == -1) {
syslog(LOG_ERR, "%s: %s: sendmsg: %m",
rap->iface->name, __func__);
+ return;
+ }
ms_to_tv(&tv, rap->retrans == 0 ? RETRANS_TIMER : rap->retrans);
ms_to_tv(&rtv, MIN_RANDOM_FACTOR);
timeradd(&tv, &rtv, &tv);
rtv.tv_sec = 0;
- rtv.tv_usec = arc4random() % (MAX_RANDOM_FACTOR_U - MIN_RANDOM_FACTOR_U);
+ rtv.tv_usec = arc4random() % (MAX_RANDOM_FACTOR_U -MIN_RANDOM_FACTOR_U);
timeradd(&tv, &rtv, &tv);
eloop_timeout_add_tv(&tv, ipv6ns_proberouter, rap);
struct in6_pktinfo pi;
int hoplimit = HOPLIMIT;
- if (!ipv6_interfacehaslinklocal(ifp)) {
+ if (ipv6_linklocal(ifp) == NULL) {
syslog(LOG_DEBUG,
"%s: delaying Router Soliciation for LL address",
ifp->name);
#endif
return;
}
+
+ /* We could recieve a RA before we sent a RS*/
+ if (ipv6_linklocal(ifp) == NULL) {
+#ifdef DEBUG_RS
+ syslog(LOG_DEBUG, "%s: received RA from %s (no link-local)",
+ ifp->name, sfrom);
+#endif
+ return;
+ }
+
TAILQ_FOREACH(rap, &ipv6_routers, next) {
if (ifp == rap->iface &&
memcmp(rap->from.s6_addr, from.sin6_addr.s6_addr,