projects
/
project
/
odhcpd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
config: Close interface when ifindex cannot be resolved
[project/odhcpd.git]
/
src
/
odhcpd.c
diff --git
a/src/odhcpd.c
b/src/odhcpd.c
index
9c7f27c
..
74830ac
100644
(file)
--- a/
src/odhcpd.c
+++ b/
src/odhcpd.c
@@
-367,6
+367,15
@@
static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even
struct sockaddr_nl nl;
} addr;
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);
+ }
+
while (true) {
struct iovec iov = {data_buf, sizeof(data_buf)};
struct msghdr msg = {
while (true) {
struct iovec iov = {data_buf, sizeof(data_buf)};
struct msghdr msg = {
@@
-446,7
+455,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;
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)
}
void odhcpd_process(struct odhcpd_event *event)