#include <libubox/uloop.h>
#include "odhcpd.h"
-
-
static int ioctl_sock = -1;
static int urandom_fd = -1;
int odhcpd_get_interface_config(const char *ifname, const char *what)
{
char buf[64];
- const char *sysctl_pattern = "/proc/sys/net/ipv6/conf/%s/%s";
- snprintf(buf, sizeof(buf), sysctl_pattern, ifname, what);
+
+ snprintf(buf, sizeof(buf), "/proc/sys/net/ipv6/conf/%s/%s", ifname, what);
int fd = open(buf, O_RDONLY);
if (fd < 0)
time_t now = odhcpd_time();
ssize_t m = -1;
+ if (!iface->dns_service)
+ return -1;
+
for (size_t i = 0; i < iface->addr6_len; ++i) {
if (iface->addr6[i].valid <= (uint32_t)now)
continue;
time_t odhcpd_time(void)
{
struct timespec ts;
- syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &ts);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec;
}