diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 3 | ||||
-rw-r--r-- | src/dhcpv4.c | 4 | ||||
-rw-r--r-- | src/dhcpv6.c | 4 | ||||
-rw-r--r-- | src/ndp.c | 6 |
4 files changed, 10 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c index e928536..3e1b3f1 100644 --- a/src/config.c +++ b/src/config.c @@ -430,6 +430,9 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr iface->name = strcpy(new_name, name); iface->avl.key = iface->name; + iface->dhcpv6_event.uloop.fd = -1; + iface->ndp_event.uloop.fd = -1; + iface->dhcpv4_event.uloop.fd = -1; set_interface_defaults(iface); avl_insert(&interfaces, &iface->avl); diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 5016390..88719e0 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -73,7 +73,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable) { int ret = 0; - if (iface->dhcpv4_event.uloop.fd > 0) { + if (iface->dhcpv4_event.uloop.fd >= 0) { uloop_fd_delete(&iface->dhcpv4_event.uloop); close(iface->dhcpv4_event.uloop.fd); iface->dhcpv4_event.uloop.fd = -1; @@ -163,7 +163,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable) } out: - if (ret < 0 && iface->dhcpv4_event.uloop.fd > 0) { + if (ret < 0 && iface->dhcpv4_event.uloop.fd >= 0) { close(iface->dhcpv4_event.uloop.fd); iface->dhcpv4_event.uloop.fd = -1; } diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 2d5861c..f71418d 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -47,7 +47,7 @@ int dhcpv6_setup_interface(struct interface *iface, bool enable) { int ret = 0; - if (iface->dhcpv6_event.uloop.fd > 0) { + if (iface->dhcpv6_event.uloop.fd >= 0) { uloop_fd_delete(&iface->dhcpv6_event.uloop); close(iface->dhcpv6_event.uloop.fd); iface->dhcpv6_event.uloop.fd = -1; @@ -150,7 +150,7 @@ int dhcpv6_setup_interface(struct interface *iface, bool enable) ret = dhcpv6_ia_setup_interface(iface, enable); out: - if (ret < 0 && iface->dhcpv6_event.uloop.fd > 0) { + if (ret < 0 && iface->dhcpv6_event.uloop.fd >= 0) { close(iface->dhcpv6_event.uloop.fd); iface->dhcpv6_event.uloop.fd = -1; } @@ -103,7 +103,7 @@ int ndp_init(void) netlink_add_netevent_handler(&ndp_netevent_handler); out: - if (ret < 0 && ping_socket > 0) { + if (ret < 0 && ping_socket >= 0) { close(ping_socket); ping_socket = -1; } @@ -125,7 +125,7 @@ int ndp_setup_interface(struct interface *iface, bool enable) goto out; } - if (iface->ndp_event.uloop.fd > 0) { + if (iface->ndp_event.uloop.fd >= 0) { uloop_fd_delete(&iface->ndp_event.uloop); close(iface->ndp_event.uloop.fd); iface->ndp_event.uloop.fd = -1; @@ -203,7 +203,7 @@ int ndp_setup_interface(struct interface *iface, bool enable) netlink_dump_neigh_table(true); out: - if (ret < 0 && iface->ndp_event.uloop.fd > 0) { + if (ret < 0 && iface->ndp_event.uloop.fd >= 0) { close(iface->ndp_event.uloop.fd); iface->ndp_event.uloop.fd = -1; } |