// Read IPv6 MTU for interface
-int odhcpd_get_interface_mtu(const char *ifname)
+int odhcpd_get_interface_config(const char *ifname, const char *what)
{
char buf[64];
- const char *sysctl_pattern = "/proc/sys/net/ipv6/conf/%s/mtu";
- snprintf(buf, sizeof(buf), sysctl_pattern, ifname);
+ const char *sysctl_pattern = "/proc/sys/net/ipv6/conf/%s/%s";
+ snprintf(buf, sizeof(buf), sysctl_pattern, ifname, what);
int fd = open(buf, O_RDONLY);
ssize_t len = read(fd, buf, sizeof(buf) - 1);
if (len < 0)
return -1;
-
buf[len] = 0;
return atoi(buf);
-
}
odhcpd_receive_packets(&event->uloop, 0);
}
-void odhcpd_urandom(void *data, size_t len)
+int odhcpd_urandom(void *data, size_t len)
{
- read(urandom_fd, data, len);
+ return read(urandom_fd, data, len);
}