From f5149a1f5af4eada0d41718d549d894ee7b69168 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 26 Nov 2015 12:02:29 +0100 Subject: [PATCH] platform: workaround kernel bug about missing IFLA_LINK/parent when creating veth The related bug rh#1285827 in kernel causes a missing IFLA_LINK/parent attribute when creating a veth pair: # ip monitor link & [1] 6745 # ip link add dev vm1 type veth peer name vm2 30: vm2@NONE: mtu 1500 qdisc noop state DOWN link/ether be:e3:b7:0e:14:52 brd ff:ff:ff:ff:ff:ff 31: vm1@vm2: mtu 1500 qdisc noop state DOWN link/ether da:e6:a6:c5:42:54 brd ff:ff:ff:ff:ff:ff Add a workaround and test. Related: https://bugzilla.redhat.com/show_bug.cgi?id=1285827 (cherry picked from commit 5650c82a8ea044ed433c05a56111161a07fb6225) Conflicts: src/platform/nm-linux-platform.c src/platform/tests/test-link.c --- src/platform/nm-linux-platform.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 2dd0b51283..736a093452 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -1945,6 +1945,20 @@ cache_pre_hook (NMPCache *cache, const NMPObject *old, const NMPObject *new, NMP NULL); } } + if ( NM_IN_SET (ops_type, NMP_CACHE_OPS_ADDED, NMP_CACHE_OPS_UPDATED) + && (new && new->_link.netlink.is_in_netlink) + && (!old || !old->_link.netlink.is_in_netlink)) + { + if ( new->link.type == NM_LINK_TYPE_VETH + && new->link.parent == 0) { + /* the initial notification when adding a veth pair can lack the parent/IFLA_LINK + * (https://bugzilla.redhat.com/show_bug.cgi?id=1285827). + * Request it again. */ + delayed_action_schedule (platform, + DELAYED_ACTION_TYPE_REFRESH_LINK, + GINT_TO_POINTER (new->link.ifindex)); + } + } { /* on enslave/release, we also refresh the master. */ int ifindex1 = 0, ifindex2 = 0;