dhcpv4: fix lease ordering by ip address
[oweals/odhcpd.git] / src / odhcpd.c
index 46878f739132ba179131c602834a2b7f08f1f3e8..4b8e5898d450bc661e0f4d29b48dfff1f35a101c 100644 (file)
@@ -45,7 +45,7 @@
 
 
 
-static int ioctl_sock;
+static int ioctl_sock = -1;
 static int urandom_fd = -1;
 
 static void sighandler(_unused int signal)
@@ -209,7 +209,7 @@ ssize_t odhcpd_send(int socket, struct sockaddr_in6 *dest,
 
        ssize_t sent = sendmsg(socket, &msg, MSG_DONTWAIT);
        if (sent < 0)
-               syslog(LOG_NOTICE, "Failed to send to %s%%%s@%s (%m)",
+               syslog(LOG_ERR, "Failed to send to %s%%%s@%s (%m)",
                                ipbuf, iface->name, iface->ifname);
        else
                syslog(LOG_DEBUG, "Sent %zd bytes to %s%%%s@%s",
@@ -300,33 +300,6 @@ struct interface* odhcpd_get_interface_by_index(int ifindex)
        return NULL;
 }
 
-
-struct interface* odhcpd_get_interface_by_name(const char *name)
-{
-       struct interface *iface;
-
-       avl_for_each_element(&interfaces, iface, avl) {
-               if (!strcmp(iface->ifname, name))
-                       return iface;
-       }
-
-       return NULL;
-}
-
-
-struct interface* odhcpd_get_master_interface(void)
-{
-       struct interface *iface;
-
-       avl_for_each_element(&interfaces, iface, avl) {
-               if (iface->master)
-                       return iface;
-       }
-
-       return NULL;
-}
-
-
 /* Convenience function to receive and do basic validation of packets */
 static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int events)
 {