Commits

Bryan O'Sullivan  committed 09b6082

Match interface name before we try to do anything else fancy.

  • Participants
  • Parent commits 168bdba

Comments (0)

Files changed (3)

 install_opts := -o root -g root
 
 CFLAGS += -Wall -Werror -std=gnu99 -g -DNP_ETC_DIR='"$(etcdir)"' \
-	-DNP_SCRIPT_DIR='"$(scriptdir)"'
+	-DNP_SCRIPT_DIR='"$(scriptdir)"' -ggdb3 -O
 
 netplugd: config.o netlink.o lib.o if_info.o main.o
 	$(CC) -o $@ $^
     }
 
     if (len < 0) {
-	do_log(LOG_ERR, "len = %d", len);
+        do_log(LOG_ERR, "Malformed netlink packet length");
         return -1;
     }
 
     char *name = RTA_DATA(attrs[IFLA_IFNAME]);
 
     if (!if_match(name)) {
-        goto done;
+        do_log(LOG_INFO, "%s: ignoring event", name);
+        return 0;
     }
 
     struct if_info *i;
 
     if ((i = if_info_get_interface(hdr, attrs)) == NULL) {
-	do_log(LOG_ERR, "if_info_get_interface returned NULL");
         return 0;
     }
 
     memset(&addr, 0, sizeof(addr));
     addr.nl_family = AF_NETLINK;
 
-    memset(&req, 0, sizeof(req));
     req.hdr.nlmsg_len = sizeof(req);
     req.hdr.nlmsg_type = RTM_GETLINK;
     req.hdr.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
                 int err;
 
                 if ((err = callback(hdr, arg)) == -1) {
+                    do_log(LOG_ERR, "Callback failed");
                     return;
                 }
             }
 
             if (callback) {
                 if ((err = callback(hdr, arg)) == -1) {
+                    do_log(LOG_ERR, "Callback failed");
                     return;
                 }
             }