chiark / gitweb /
networkd: improve logging when processing links and addresses
authorTom Gundersen <teg@jklm.no>
Fri, 3 Apr 2015 13:21:03 +0000 (15:21 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 3 Apr 2015 13:35:07 +0000 (15:35 +0200)
src/network/networkd-link.c
src/network/networkd-manager.c

index 437c598..3bd37d8 100644 (file)
@@ -1853,11 +1853,14 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
         if (r < 0) {
                 log_warning("rtnl: could not get message type");
                 return 0;
+        } else if (type != RTM_NEWADDR && type != RTM_DELADDR) {
+                log_warning("rtnl: received unexpected message type when processing address");
+                return 0;
         }
 
         r = sd_rtnl_message_addr_get_ifindex(message, &ifindex);
         if (r < 0) {
-                log_warning_errno(r, "rtnl: could not get ifindex: %m");
+                log_warning_errno(r, "rtnl: could not get ifindex from address: %m");
                 return 0;
         } else if (ifindex <= 0) {
                 log_warning("rtnl: received address message with invalid ifindex: %d", ifindex);
index cffae83..0e204eb 100644 (file)
@@ -299,11 +299,14 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
         if (r < 0) {
                 log_warning_errno(r, "rtnl: could not get message type: %m");
                 return 0;
+        } else if (type != RTM_NEWLINK && type != RTM_DELLINK) {
+                log_warning("rtnl: received unexpected message type when processing link");
+                return 0;
         }
 
         r = sd_rtnl_message_link_get_ifindex(message, &ifindex);
         if (r < 0) {
-                log_warning_errno(r, "rtnl: could not get ifindex: %m");
+                log_warning_errno(r, "rtnl: could not get ifindex from link: %m");
                 return 0;
         } else if (ifindex <= 0) {
                 log_warning("rtnl: received link message with invalid ifindex: %d", ifindex);