setup_dhcpv6_interface(i, !i->ignore || i->dhcpv6 != RELAYD_DISABLED);
setup_ndp_interface(i, !i->ignore || i->ndp != RELAYD_DISABLED);
setup_dhcpv4_interface(i, !i->ignore || i->dhcpv4 != RELAYD_DISABLED);
- } else {
+ } else
close_interface(i);
- }
}
+ ndp_handle_addr6_dump();
uci_unload(uci, dhcp);
uci_free_context(uci);
}
if (iface->dhcpv6 == RELAYD_SERVER)
setsockopt(sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &server, sizeof(server));
+ if (iface->dhcpv6 != RELAYD_RELAY || !iface->master)
+ ndp_rqs_addr6_dump();
+
iface->dhcpv6_event.uloop.fd = sock;
iface->dhcpv6_event.handle_dgram = handle_dhcpv6;
odhcpd_register(&iface->dhcpv6_event);
static int cb_rtnl_valid(struct nl_msg *msg, void *arg);
static void catch_rtnl_err(struct odhcpd_event *e, int error);
+static int addr6_dump_rqs = 0;
static int ping_socket = -1;
static struct event_socket rtnl_event = {
.ev = {
nlmsg_free(msg);
}
-static void dump_addr_table(void)
+static void dump_addr6_table(void)
{
struct nl_msg *msg;
struct ifaddrmsg ifa = {
nlmsg_free(msg);
}
+void ndp_handle_addr6_dump(void)
+{
+ if (!addr6_dump_rqs)
+ return;
+
+ dump_addr6_table();
+ addr6_dump_rqs = 0;
+}
+
+inline void ndp_rqs_addr6_dump(void)
+{
+ addr6_dump_rqs++;
+}
+
int setup_ndp_interface(struct interface *iface, bool enable)
{
int ret = 0, procfd;
dump_neigh = true;
}
- if (enable && (iface->ra == RELAYD_SERVER ||
- iface->dhcpv6 == RELAYD_SERVER || iface->ndp == RELAYD_RELAY))
- dump_addr_table();
-
if (enable && iface->ndp == RELAYD_RELAY) {
if (write(procfd, "1\n", 2) < 0) {}
dump_neigh_table(false);
else
dump_neigh = false;
+
+ ndp_rqs_addr6_dump();
}
if (dump_neigh)
if (nl_socket_set_buffer_size(ev_sock->sock, ev_sock->sock_bufsize, 0))
goto err;
- dump_addr_table();
+ dump_addr6_table();
return;
err:
int config_parse_interface(void *data, size_t len, const char *iname, bool overwrite);
+void ndp_handle_addr6_dump(void);
+void ndp_rqs_addr6_dump(void);
+
#ifdef WITH_UBUS
int init_ubus(void);
const char* ubus_get_ifname(const char *name);
} else if (iface->ra == RELAYD_SERVER && !iface->master) {
iface->timer_rs.cb = trigger_router_advert;
uloop_timeout_set(&iface->timer_rs, 1000);
+ ndp_rqs_addr6_dump();
}
if (iface->ra == RELAYD_RELAY || (iface->ra == RELAYD_SERVER && !iface->master))