syslog(LOG_INFO, "%s: %s is no longer a router",
ifp->name, sfrom);
rap->expired = 1;
+ ipv6ns_cancelproberouter(rap);
ipv6_buildroutes();
script_runreason(ifp, "ROUTERADVERT");
return;
}
- if (is_solicited) {
+ if (is_solicited && is_router && rap->lifetime) {
if (rap->expired) {
rap->expired = 0;
syslog(LOG_INFO, "%s: %s is reachable again",
break;
}
+ nd_ra = (struct nd_router_advert *)icp;
+ /* Don't bother doing anything if we don't know about a router
+ * expiring */
+ if ((rap == NULL || rap->lifetime == 0)
+ && nd_ra->nd_ra_router_lifetime == 0)
+ return;
+
/* We don't want to spam the log with the fact we got an RA every
* 30 seconds or so, so only spam the log if it's different. */
if (options & DHCPCD_DEBUG || rap == NULL ||
}
get_monotonic(&rap->received);
- nd_ra = (struct nd_router_advert *)icp;
rap->flags = nd_ra->nd_ra_flags_reserved;
+ if (new_rap == 0 && rap->lifetime == 0)
+ syslog(LOG_WARNING, "%s: %s router available",
+ ifp->name, rap->sfrom);
rap->lifetime = ntohs(nd_ra->nd_ra_router_lifetime);
if (nd_ra->nd_ra_reachable) {
rap->reachable = ntohl(nd_ra->nd_ra_reachable);
ifp->options->options & DHCPCD_IPV6RA_OWN_DEFAULT)
{
rap->nsprobes = 0;
- ipv6ns_proberouter(rap);
+ if (rap->lifetime)
+ ipv6ns_proberouter(rap);
}
handle_flag:
lt.tv_sec = rap->lifetime;
lt.tv_usec = 0;
timeradd(&rap->received, <, &expire);
- if (timercmp(&now, &expire, >)) {
+ if (rap->lifetime == 0 || timercmp(&now, &expire, >)) {
valid = 0;
if (!rap->expired) {
syslog(LOG_WARNING,
- "%s: %s: expired default Router",
+ "%s: %s: router expired",
ifp->name, rap->sfrom);
rap->expired = expired = 1;
ipv6ns_cancelproberouter(rap);
/* No valid lifetimes are left on the RA, so we might
* as well punt it. */
- if (!valid)
+ if (!valid && TAILQ_FIRST(&rap->addrs) == NULL)
ipv6rs_free_ra(rap);
}
{
struct rs_state *state;
- syslog(LOG_INFO, "%s: soliciting an IPv6 Router", ifp->name);
+ syslog(LOG_INFO, "%s: soliciting an IPv6 router", ifp->name);
if (sock == -1) {
if (ipv6rs_open() == -1) {
syslog(LOG_ERR, "%s: ipv6rs_open: %m", __func__);