summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2020-03-16 14:36:26 +0100
committerSusant Sahani <ssahani@vmware.com>2020-03-16 15:33:16 +0100
commit2b2a1ae6fb66dbb2ecaab57249d486224eb6c7ee (patch)
treef71dcf4f222150835df42c0a7c1cfd795beab866 /src
parenthome: fix segfault when parsing arguments in PAM module (diff)
downloadsystemd-2b2a1ae6fb66dbb2ecaab57249d486224eb6c7ee.tar.xz
systemd-2b2a1ae6fb66dbb2ecaab57249d486224eb6c7ee.zip
networkctl: Add support to display vlan ID
Diffstat (limited to 'src')
-rw-r--r--src/network/networkctl.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 70adf4c73b..1529a0d653 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -148,6 +148,9 @@ typedef struct LinkInfo {
/* vxlan info */
VxLanInfo vxlan_info;
+ /* vlan info */
+ uint16_t vlan_id;
+
/* ethtool info */
int autonegotiation;
uint64_t speed;
@@ -239,7 +242,8 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
(void) sd_netlink_message_read_u32(m, IFLA_VXLAN_LINK, &info->vxlan_info.link);
(void) sd_netlink_message_read_u16(m, IFLA_VXLAN_PORT, &info->vxlan_info.dest_port);
- }
+ } else if (streq(received_kind, "vlan"))
+ (void) sd_netlink_message_read_u16(m, IFLA_VLAN_ID, &info->vlan_id);
strncpy(info->netdev_kind, received_kind, IFNAMSIZ);
@@ -1427,6 +1431,13 @@ static int link_status_one(
if (r < 0)
return table_log_add_error(r);
}
+ } else if (streq_ptr(info->netdev_kind, "vlan") && info->vlan_id > 0) {
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_STRING, "VLan Id:",
+ TABLE_UINT16, info->vlan_id);
+ if (r < 0)
+ return table_log_add_error(r);
}
if (info->has_wlan_link_info) {