summary refs log tree commit diff
path: root/src/platform/nm-linux-platform.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2017-07-12 17:57:30 +0200
committerMichael Biebl <biebl@debian.org>2017-07-12 17:57:30 +0200
commitb9f0451fa35393ceedf6d9d20b78c43578ebea5d (patch)
tree417afcdd717020ad44e25fadee4b89de23316e83 /src/platform/nm-linux-platform.c
parentc333f062ddcba9b35330647bf6cbd0a07f2d786e (diff)
New upstream version 1.8.2 upstream/1.8.2
Diffstat (limited to 'src/platform/nm-linux-platform.c')
-rw-r--r--src/platform/nm-linux-platform.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 252f054d..487725e4 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1529,6 +1529,23 @@ _new_from_nl_link (NMPlatform *platform, const NMPCache *cache, struct nlmsghdr
 	if (!obj->link.name[0])
 		goto errout;
 
+	if (!tb[IFLA_MTU]) {
+		/* Kernel has two places that send RTM_GETLINK messages:
+		 * net/core/rtnetlink.c and net/wireless/ext-core.c.
+		 * Unfotunatelly ext-core.c sets only IFLA_WIRELESS and
+		 * IFLA_IFNAME. This confuses code in this function, because
+		 * it cannot get complete set of data for the interface and
+		 * later incomplete object this function creates is used to
+		 * overwrite existing data in NM's cache.
+		 * Since ext-core.c doesn't set IFLA_MTU we can use it as a
+		 * signal to ignore incoming message.
+		 * To some extent this is a hack and correct approach is to
+		 * merge objects per-field.
+		 */
+		goto errout;
+	}
+	obj->link.mtu = nla_get_u32 (tb[IFLA_MTU]);
+
 	if (tb[IFLA_LINKINFO]) {
 		err = nla_parse_nested (li, IFLA_INFO_MAX, tb[IFLA_LINKINFO], policy_link_info);
 		if (err < 0)
@@ -1609,9 +1626,6 @@ _new_from_nl_link (NMPlatform *platform, const NMPCache *cache, struct nlmsghdr
 		}
 	}
 
-	if (tb[IFLA_MTU])
-		obj->link.mtu = nla_get_u32 (tb[IFLA_MTU]);
-
 	switch (obj->link.type) {
 	case NM_LINK_TYPE_GRE:
 		lnk_data = _parse_lnk_gre (nl_info_kind, nl_info_data);