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);
{
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;
}
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;
}
{
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;
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;
}
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;
}
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;
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;
}