]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
netlink: workaround veth being peered together through IFLA_LINK
authorVincent Bernat <vincent@bernat.im>
Mon, 17 Aug 2015 06:51:46 +0000 (08:51 +0200)
committerVincent Bernat <vincent@bernat.im>
Mon, 17 Aug 2015 06:58:44 +0000 (08:58 +0200)
This is a change introduced in Linux 4.1. It's easy to detect, so,
workaround it. See:

    commit a45253bf32bf49cdb2807bad212b84f5ab51ac26
    Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Date:   Thu Apr 2 17:07:11 2015 +0200

        veth: set iflink to the peer veth

        Now that the peer netns is advertised in rtnl messages, we can set this property
        so that IFLA_LINK will advertise the peer ifindex. It allows the userland to get
        the full veth configuration.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
src/daemon/netlink.c

index 0e3dba8a73c36ac8bca600357a501066761502e2..6579dd321db981c7b9d7eb2e24fb0d5386d48654 100644 (file)
@@ -443,7 +443,11 @@ netlink_get_interfaces()
         if (iface1->lower_idx != -1 && iface1->lower_idx != iface1->index)
             TAILQ_FOREACH(iface2, ifs, next) {
                 if (iface1->lower_idx == iface2->index) {
-                    iface1->lower = iface2;
+                    if (iface2->lower_idx == iface1->index) {
+                        /* Workaround a bug introduced in Linux 4.1 */
+                        iface2->lower_idx = iface2->index;
+                        iface1->lower_idx = iface1->index;
+                    } else iface1->lower = iface2;
                     break;
                 }
             }