odhcpd: fix compilation with GCC10
[project/odhcpd.git] / src / odhcpd.c
index 46878f739132ba179131c602834a2b7f08f1f3e8..39e0e5137cf5514555f0ea98420d45bfe284b47d 100644 (file)
@@ -43,9 +43,7 @@
 #include <libubox/uloop.h>
 #include "odhcpd.h"
 
-
-
-static int ioctl_sock;
+static int ioctl_sock = -1;
 static int urandom_fd = -1;
 
 static void sighandler(_unused int signal)
@@ -209,7 +207,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 +298,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)
 {
@@ -467,7 +438,7 @@ int odhcpd_urandom(void *data, size_t len)
 time_t odhcpd_time(void)
 {
        struct timespec ts;
-       syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &ts);
+       clock_gettime(CLOCK_MONOTONIC, &ts);
        return ts.tv_sec;
 }