From 7d0a497539e39702b9c48a6610f4d81799aea3a9 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 17 Aug 2015 08:51:46 +0200 Subject: [PATCH] netlink: workaround veth being peered together through IFLA_LINK This is a change introduced in Linux 4.1. It's easy to detect, so, workaround it. See: commit a45253bf32bf49cdb2807bad212b84f5ab51ac26 Author: Nicolas Dichtel 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 Signed-off-by: David S. Miller --- src/daemon/netlink.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/daemon/netlink.c b/src/daemon/netlink.c index 694e4e34..1bc606a3 100644 --- a/src/daemon/netlink.c +++ b/src/daemon/netlink.c @@ -267,9 +267,17 @@ netlink_get_interfaces(struct lldpd *cfg) if (iface1->lower_idx != 0 && iface1->lower_idx != iface1->index) TAILQ_FOREACH(iface2, ifs, next) { if (iface1->lower_idx == iface2->index) { - log_debug("netlink", "%s is lower iface for %s", - iface2->name, iface1->name); - iface1->lower = iface2; + if (iface2->lower_idx == iface1->index) { + log_debug("netlink", "%s and %s are peered together", + iface1->name, iface2->name); + /* Workaround a bug introduced in Linux 4.1 */ + iface2->lower_idx = iface2->index; + iface1->lower_idx = iface1->index; + } else { + log_debug("netlink", "%s is lower iface for %s", + iface2->name, iface1->name); + iface1->lower = iface2; + } break; } } -- 2.39.5