summaryrefslogtreecommitdiffhomepage
path: root/src/odhcpd.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2015-11-16 12:10:24 +0100
committerSteven Barth <steven@midlink.org>2015-11-16 12:10:52 +0100
commite60710d1fe0c5bf19b9acf9b116e0645e8e114d1 (patch)
tree9a3c3c9f8269d5f918d69aa34a428826850144f9 /src/odhcpd.c
parentaa3a13659ad6d2934f31e47a805b462269645f2d (diff)
Handle netlink ENOBUFS events
Diffstat (limited to 'src/odhcpd.c')
-rw-r--r--src/odhcpd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/odhcpd.c b/src/odhcpd.c
index 9c7f27c..0c9542c 100644
--- a/src/odhcpd.c
+++ b/src/odhcpd.c
@@ -367,6 +367,16 @@ static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even
struct sockaddr_nl nl;
} addr;
+ if (u->error) {
+ int ret = -1;
+ socklen_t ret_len = sizeof(ret);
+ getsockopt(u->fd, SOL_SOCKET, SO_ERROR, &ret, &ret_len);
+ u->error = false;
+ if (e->handle_error)
+ e->handle_error(ret);
+ return;
+ }
+
while (true) {
struct iovec iov = {data_buf, sizeof(data_buf)};
struct msghdr msg = {
@@ -446,7 +456,8 @@ static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even
int odhcpd_register(struct odhcpd_event *event)
{
event->uloop.cb = odhcpd_receive_packets;
- return uloop_fd_add(&event->uloop, ULOOP_READ);
+ return uloop_fd_add(&event->uloop, ULOOP_READ |
+ ((event->handle_error) ? ULOOP_ERROR_CB : 0));
}
void odhcpd_process(struct odhcpd_event *event)