if (change)
dhcpv6_ia_postupdate(iface, now);
- if (change)
+ if (change) {
+ syslog(LOG_DEBUG, "Raising SIGUSR1 due to address change");
raise(SIGUSR1);
+ }
}
if (is_route) {
// Inform about a change in default route
- if (rtm->rtm_dst_len == 0)
+ if (rtm->rtm_dst_len == 0) {
+ syslog(LOG_DEBUG, "Raising SIGUSR1 due to default route change");
raise(SIGUSR1);
+ }
continue;
}
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
+#include <arpa/inet.h>
#include <net/route.h>
#include "router.h"
adv.h.nd_ra_router_lifetime = htons(iface->default_router);
else if (parse_routes(addrs, ipcnt))
adv.h.nd_ra_router_lifetime = htons(1);
+
+ syslog(LOG_DEBUG, "Initial router lifetime %d, %d address(es) available",
+ ntohs(adv.h.nd_ra_router_lifetime), ipcnt);
}
// Construct Prefix Information options
for (ssize_t i = 0; i < ipcnt; ++i) {
struct odhcpd_ipaddr *addr = &addrs[i];
- if (addr->prefix > 96 || addr->valid <= (uint32_t)now)
- continue; // Address not suitable
+
+ if (addr->prefix > 96 || addr->valid <= (uint32_t)now) {
+ char namebuf[INET6_ADDRSTRLEN];
+
+ inet_ntop(AF_INET6, addr, namebuf, sizeof(namebuf));
+ syslog(LOG_DEBUG, "Address %s (prefix %d, valid %u) not suitable",
+ namebuf, addr->prefix, addr->valid);
+ continue;
+ }
struct nd_opt_prefix_info *p = NULL;
for (size_t i = 0; i < cnt; ++i) {
this_lifetime = UINT16_MAX;
if (((addr->addr.s6_addr[0] & 0xfe) != 0xfc || iface->default_router)
&& adv.h.nd_ra_router_lifetime
- && ntohs(adv.h.nd_ra_router_lifetime) < this_lifetime)
+ && ntohs(adv.h.nd_ra_router_lifetime) < this_lifetime) {
adv.h.nd_ra_router_lifetime = htons(this_lifetime);
+ syslog(LOG_DEBUG, "Updating router lifetime to %d", this_lifetime);
+ }
+
odhcpd_bmemcpy(&p->nd_opt_pi_prefix, &addr->addr,
(iface->ra_advrouter) ? 128 : addr->prefix);
p->nd_opt_pi_type = ND_OPT_PREFIX_INFORMATION;