diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index c62d36d56..a711ae2fa 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -949,6 +949,9 @@ init_link (NMPlatform *platform, NMPlatformLink *info, struct rtnl_link *rtnllin info->parent = rtnl_link_get_link (rtnllink); info->mtu = rtnl_link_get_mtu (rtnllink); + if (info->type == NM_LINK_TYPE_VLAN) + info->vlan_id = rtnl_link_vlan_get_id (rtnllink); + udev_device = g_hash_table_lookup (priv->udev_devices, GINT_TO_POINTER (info->ifindex)); if (udev_device) { info->driver = nmp_utils_udev_get_driver (udev_device); diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 19587eeb3..0d9ae57e3 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -2442,6 +2442,7 @@ nm_platform_link_to_string (const NMPlatformLink *link) char parent[20]; char str_flags[64]; char *driver, *udi; + char str_vlan[16]; GString *str; if (!link) @@ -2472,18 +2473,25 @@ nm_platform_link_to_string (const NMPlatformLink *link) else parent[0] = 0; + if (link->vlan_id) + g_snprintf (str_vlan, sizeof (str_vlan), " vlan %u", (guint) link->vlan_id); + else + str_vlan[0] = '\0'; + driver = link->driver ? g_strdup_printf (" driver '%s'", link->driver) : NULL; udi = link->udi ? g_strdup_printf (" udi '%s'", link->udi) : NULL; g_snprintf (to_string_buffer, sizeof (to_string_buffer), "%d: %s%s <%s> mtu %d%s " "%s" /* link->type */ "%s%s" /* kind */ + "%s" /* vlan */ "%s%s", link->ifindex, link->name, parent, str->str, link->mtu, master, nm_link_type_to_string (link->type), link->type != NM_LINK_TYPE_UNKNOWN && link->kind ? " kind " : "", link->type != NM_LINK_TYPE_UNKNOWN && link->kind ? link->kind : "", + str_vlan, driver ? driver : "", udi ? udi : ""); g_string_free (str, TRUE); g_free (driver); @@ -2769,6 +2777,7 @@ nm_platform_link_cmp (const NMPlatformLink *a, const NMPlatformLink *b) _CMP_FIELD (a, b, master); _CMP_FIELD (a, b, parent); _CMP_FIELD (a, b, up); + _CMP_FIELD (a, b, vlan_id); _CMP_FIELD (a, b, flags); _CMP_FIELD (a, b, connected); _CMP_FIELD (a, b, arp); diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index bb558699c..8230ee9c4 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -101,6 +101,9 @@ struct _NMPlatformLink { int master; int parent; + /* rtnl_link_vlan_get_id(), IFLA_VLAN_ID */ + guint16 vlan_id; + /* IFF_* flags as u32. Note that ifi_flags in 'struct ifinfomsg' is declared as 'unsigned', * but libnl stores the flag internally as u32. */ guint32 flags;