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.
This commit is contained in:
Thomas Haller 2018-04-05 15:14:10 +02:00
parent f76a94668d
commit 722f79c9c5

View file

@ -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