]> xenbits.xensource.com Git - libvirt.git/commitdiff
macvtap: work-around for 2.6.32 and older kernels
authorStefan Berger <stefanb@us.ibm.com>
Thu, 17 Jun 2010 11:05:38 +0000 (07:05 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Thu, 17 Jun 2010 11:05:38 +0000 (07:05 -0400)
This patch works around a recent extension of the netlink driver I had made use of when building the netlink messages. Unfortunately older kernels don't accept IFLA_IFNAME + name of interface as a replacement for the interface's index, so this patch now gets the interface index ifindex if it's not provided (ifindex <= 0).

src/util/macvtap.c

index fb333eb8bcb8e65779766bf4c962440e22a80d21..635458d336374056c2f3c09f9c062296e48b80c1 100644 (file)
@@ -905,6 +905,9 @@ ifaceGetNthParent(int ifindex, const char *ifname, unsigned int nthParent,
 
     *nth = 0;
 
+    if (ifindex <= 0 && ifaceGetIndex(true, ifname, &ifindex) != 0)
+        return 1;
+
     while (!end && i <= nthParent) {
         rc = link_dump(true, ifname, ifindex, tb, &recvbuf);
         if (rc)