X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fodhcpd.c;h=aad5b37b2e5b831c9c910660bcc453659060e5ce;hp=52bca13c4db7019a2ccbaee44c6ed88fa30ae022;hb=ebbff3872a1f242ef5b0a7c029895848876a54b2;hpb=73a7133b6e42edc218da5b8011c580ed48c7731a diff --git a/src/odhcpd.c b/src/odhcpd.c index 52bca13..aad5b37 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -113,11 +113,11 @@ int odhcpd_open_rtnl(void) // 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); @@ -126,10 +126,8 @@ int odhcpd_get_interface_mtu(const char *ifname) if (len < 0) return -1; - buf[len] = 0; return atoi(buf); - }