diff options
author | Anita Zhang <the.anitazha@gmail.com> | 2020-03-16 20:56:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 20:56:07 +0100 |
commit | a4f4a4e44100025cfbe01b042db386e0e933c627 (patch) | |
tree | f6baecb909edad7e894d6c38ae1d74119765be7b /src | |
parent | Merge pull request #15139 from DaanDeMeyer/sd-bus-remove-unused-cite (diff) | |
parent | networkctl: Add support to display vlan ID (diff) | |
download | systemd-a4f4a4e44100025cfbe01b042db386e0e933c627.tar.xz systemd-a4f4a4e44100025cfbe01b042db386e0e933c627.zip |
Merge pull request #15138 from ssahani/networkctl-vlan
networkctl: Add support to display vlan ID
Diffstat (limited to 'src')
-rw-r--r-- | src/network/networkctl.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 5a348ef715..5732e17f20 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -149,6 +149,9 @@ typedef struct LinkInfo { /* vxlan info */ VxLanInfo vxlan_info; + /* vlan info */ + uint16_t vlan_id; + /* ethtool info */ int autonegotiation; uint64_t speed; @@ -240,7 +243,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); @@ -1439,6 +1443,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) { |