From 722f79c9c563192a46dddb921bfc00c24687f2ff Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 5 Apr 2018 15:14:10 +0200 Subject: [PATCH] platform: workaround kernel issue for tun device for first RTM_NETLINK event Due to a bug, the current rc-kernel will emit the first netlink notification about tun devices before the device is initialized. Hence, the content of the message is bogus. If the message looks like to be this case, re-request it right away. --- 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 3c01d3d36e..8923708657 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -3931,6 +3931,7 @@ cache_on_change (NMPlatform *platform, && (!obj_old || !obj_old->_link.netlink.is_in_netlink)) { gboolean re_request_link = FALSE; + const NMPlatformLnkTun *lnk_tun; if ( !obj_new->_link.netlink.lnk && NM_IN_SET (obj_new->link.type, NM_LINK_TYPE_GRE, @@ -3948,6 +3949,19 @@ cache_on_change (NMPlatform *platform, * * For example https://bugzilla.redhat.com/show_bug.cgi?id=1284001 */ re_request_link = TRUE; + } else if ( obj_new->link.type == NM_LINK_TYPE_TUN + && obj_new->_link.netlink.lnk + && (lnk_tun = &(obj_new->_link.netlink.lnk)->lnk_tun) + && !lnk_tun->persist + && lnk_tun->pi + && !lnk_tun->vnet_hdr + && !lnk_tun->multi_queue + && !lnk_tun->owner_valid + && !lnk_tun->group_valid) { + /* kernel has/had a know issue that the first notification for TUN device would + * be sent with invalid parameters. The message looks like that kind, so refetch + * it. */ + re_request_link = TRUE; } else if ( obj_new->link.type == NM_LINK_TYPE_VETH && obj_new->link.parent == 0) { /* the initial notification when adding a veth pair can lack the parent/IFLA_LINK