int val = 256 * 1024;
// Setup netlink socket
- if ((rtnl_event.uloop.fd = odhcpd_open_rtnl()) < 0)
+ if ((rtnl_event.uloop.fd = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE)) < 0)
+ return -1;
+
+ struct sockaddr_nl nl = {.nl_family = AF_NETLINK};
+ if (connect(rtnl_event.uloop.fd, (struct sockaddr*)&nl, sizeof(nl)) < 0)
return -1;
if (setsockopt(rtnl_event.uloop.fd, SOL_SOCKET, SO_RCVBUF, &val, sizeof(val)))
// Check address update
static void check_updates(struct interface *iface)
{
- struct odhcpd_ipaddr addr[8] = {{IN6ADDR_ANY_INIT, 0, 0, 0, 0}};
+ struct odhcpd_ipaddr addr[RELAYD_MAX_ADDRS] = {{IN6ADDR_ANY_INIT, 0, 0, 0, 0}};
time_t now = odhcpd_time();
- ssize_t len = odhcpd_get_interface_addresses(iface->ifindex, addr, 8);
+ ssize_t len = odhcpd_get_interface_addresses(iface->ifindex, addr, ARRAY_SIZE(addr));
if (len < 0)
return;
if (change)
dhcpv6_ia_postupdate(iface, now);
- if (change)
+ if (change) {
+ syslog(LOG_INFO, "Raising SIGUSR1 due to address change on %s", iface->ifname);
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_INFO, "Raising SIGUSR1 due to default route change");
raise(SIGUSR1);
+ }
continue;
}
if (is_addr) {
check_updates(iface);
- if (iface->dhcpv6 == RELAYD_SERVER)
- iface->ia_reconf = true;
-
if (iface->ndp == RELAYD_RELAY && iface->master) {
// Replay address changes on all slave interfaces
nh->nlmsg_flags = NLM_F_REQUEST;