Deregister netlink event socket in case of error different
from ENOBUFS or failure to set netlink rx buffer size
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
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);
}
((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);
// 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);