Disable debugging by default
[project/odhcpd.git] / src / odhcpd.c
index 5a800b7..39ce98e 100644 (file)
@@ -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) {
@@ -244,10 +245,9 @@ ssize_t odhcpd_get_interface_addresses(int ifindex,
                addrs[ret].class = 0;
 #ifdef WITH_UBUS
                struct interface *iface = odhcpd_get_interface_by_index(ifindex);
-               if (iface) {
-                       addrs[ret].has_class = true;
-                       addrs[ret].class = ubus_get_class(iface->ifname, &addrs[ret].addr);
-               }
+               if (iface)
+                       addrs[ret].has_class = ubus_get_class(iface->ifname,
+                                       &addrs[ret].addr, &addrs[ret].class);
 #endif
                ++ret;
        }
@@ -321,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);