diff options
Diffstat (limited to 'src/ndp.c')
-rw-r--r-- | src/ndp.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -49,6 +49,7 @@ static void handle_rtnl_event(struct odhcpd_event *ev); 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 = { @@ -150,7 +151,7 @@ static void dump_neigh_table(const bool proxy) nlmsg_free(msg); } -static void dump_addr_table(void) +static void dump_addr6_table(void) { struct nl_msg *msg; struct ifaddrmsg ifa = { @@ -168,6 +169,20 @@ static void dump_addr_table(void) 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; @@ -193,10 +208,6 @@ int setup_ndp_interface(struct interface *iface, bool enable) 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) {} @@ -243,6 +254,8 @@ int setup_ndp_interface(struct interface *iface, bool enable) dump_neigh_table(false); else dump_neigh = false; + + ndp_rqs_addr6_dump(); } if (dump_neigh) @@ -570,7 +583,7 @@ static void catch_rtnl_err(struct odhcpd_event *e, int error) if (nl_socket_set_buffer_size(ev_sock->sock, ev_sock->sock_bufsize, 0)) goto err; - dump_addr_table(); + dump_addr6_table(); return; err: |