#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)
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",
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)
{
time_t odhcpd_time(void)
{
struct timespec ts;
- syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &ts);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec;
}