X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=blobdiff_plain;f=src%2Fodhcpd.c;h=39ce98ea5895a7ea0f47523e752bb28c93110168;hp=acedaec0b13cf26cef5dc72cfd5bf4ed56506ab9;hb=0903c8170e762a8ab9fa45d521b7d509a0acdaa2;hpb=7117854698ba7c77da5823fc673f44e6db0fee5f diff --git a/src/odhcpd.c b/src/odhcpd.c index acedaec..39ce98e 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -52,6 +52,7 @@ static int urandom_fd = -1; int main() { openlog("odhcpd", LOG_PERROR | LOG_PID, LOG_DAEMON); + setlogmask(LOG_UPTO(LOG_INFO)); uloop_init(); if (getuid() != 0) { @@ -83,9 +84,6 @@ int main() if (init_dhcpv4()) return 4; - if (init_ubus()) - return 4; - odhcpd_run(); return 0; } @@ -243,6 +241,14 @@ ssize_t odhcpd_get_interface_addresses(int ifindex, if (ifa->ifa_flags & IFA_F_DEPRECATED) addrs[ret].preferred = 0; + addrs[ret].has_class = false; + addrs[ret].class = 0; +#ifdef WITH_UBUS + struct interface *iface = odhcpd_get_interface_by_index(ifindex); + if (iface) + addrs[ret].has_class = ubus_get_class(iface->ifname, + &addrs[ret].addr, &addrs[ret].class); +#endif ++ret; } @@ -315,8 +321,7 @@ static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even int *hlim = NULL; struct in6_pktinfo *pktinfo; struct in_pktinfo *pkt4info; - for (struct cmsghdr *ch = CMSG_FIRSTHDR(&msg); ch != NULL && - destiface == 0; ch = CMSG_NXTHDR(&msg, ch)) { + for (struct cmsghdr *ch = CMSG_FIRSTHDR(&msg); ch != NULL; ch = CMSG_NXTHDR(&msg, ch)) { if (ch->cmsg_level == IPPROTO_IPV6 && ch->cmsg_type == IPV6_PKTINFO) { pktinfo = (struct in6_pktinfo*)CMSG_DATA(ch);