summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/ndp.c8
-rw-r--r--src/odhcpd.c6
-rw-r--r--src/odhcpd.h1
3 files changed, 13 insertions, 2 deletions
diff --git a/src/ndp.c b/src/ndp.c
index c6e4eda..427547d 100644
--- a/src/ndp.c
+++ b/src/ndp.c
@@ -539,13 +539,17 @@ static void catch_rtnl_err(struct odhcpd_event *e, int error)
struct event_socket *ev_sock = container_of(e, struct event_socket, ev);
if (error != ENOBUFS)
- return;
+ goto err;
/* Double netlink event buffer size */
ev_sock->sock_bufsize *= 2;
if (nl_socket_set_buffer_size(ev_sock->sock, ev_sock->sock_bufsize, 0))
- return;
+ goto err;
dump_addr_table();
+ return;
+
+err:
+ odhcpd_deregister(e);
}
diff --git a/src/odhcpd.c b/src/odhcpd.c
index 2b0ea98..ed96178 100644
--- a/src/odhcpd.c
+++ b/src/odhcpd.c
@@ -566,6 +566,12 @@ int odhcpd_register(struct odhcpd_event *event)
((event->handle_error) ? ULOOP_ERROR_CB : 0));
}
+int odhcpd_deregister(struct odhcpd_event *event)
+{
+ event->uloop.cb = NULL;
+ return uloop_fd_delete(&event->uloop);
+}
+
void odhcpd_process(struct odhcpd_event *event)
{
odhcpd_receive_packets(&event->uloop, 0);
diff --git a/src/odhcpd.h b/src/odhcpd.h
index 393194c..fb78ec0 100644
--- a/src/odhcpd.h
+++ b/src/odhcpd.h
@@ -188,6 +188,7 @@ extern struct list_head interfaces;
// Exported main functions
int odhcpd_register(struct odhcpd_event *event);
+int odhcpd_deregister(struct odhcpd_event *event);
void odhcpd_process(struct odhcpd_event *event);
struct nl_sock *odhcpd_create_nl_socket(int protocol);