discover/network: ignore devices with zero MTU
authorJeremy Kerr <jk@ozlabs.org>
Thu, 19 Sep 2013 13:48:32 +0000 (21:48 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 19 Sep 2013 13:48:32 +0000 (21:48 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/network.c

index 28e3a29cb2b3621beb3c7ea69c6a06927fc86fe0..2d606e4c1c563a1d522e41e8e0282e2ffb57a9fe 100644 (file)
@@ -325,6 +325,7 @@ static int network_handle_nlmsg(struct network *network, struct nlmsghdr *nlmsg)
        struct interface *interface;
        struct ifinfomsg *info;
        struct rtattr *attr;
+       unsigned int mtu;
        uint8_t ifaddr[6];
        char ifname[IFNAMSIZ+1];
        int attrlen, type;
@@ -355,13 +356,17 @@ static int network_handle_nlmsg(struct network *network, struct nlmsghdr *nlmsg)
                        strncpy(ifname, data, IFNAMSIZ);
                        have_ifname = true;
                        break;
+
+               case IFLA_MTU:
+                       mtu = *(unsigned int *)data;
+                       break;
                }
        }
 
        if (!have_ifaddr || !have_ifname)
                return -1;
 
-       if (type == RTM_DELLINK) {
+       if (type == RTM_DELLINK || mtu == 0) {
                interface = find_interface_by_ifindex(network, info->ifi_index);
                if (!interface)
                        return 0;