1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

networkctl: Add support to display master device

This commit is contained in:
Susant Sahani 2020-03-14 10:09:48 +01:00 committed by Yu Watanabe
parent f12d19b304
commit 6cfef1b308

View File

@ -120,6 +120,7 @@ typedef struct LinkInfo {
unsigned short iftype;
struct ether_addr mac_address;
struct ether_addr permanent_mac_address;
uint32_t master;
uint32_t mtu;
uint32_t min_mtu;
uint32_t max_mtu;
@ -342,6 +343,8 @@ static int decode_link(sd_netlink_message *m, LinkInfo *info, char **patterns, b
return log_oom();
}
(void) sd_netlink_message_read_u32(m, IFLA_MASTER, &info->master);
/* fill kind info */
(void) decode_netdev(m, info);
@ -1354,6 +1357,15 @@ static int link_status_one(
return table_log_add_error(r);
}
if (info->master > 0) {
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "Master:",
TABLE_IFINDEX, info->master);
if (r < 0)
return table_log_add_error(r);
}
if (streq_ptr(info->netdev_kind, "bridge")) {
r = table_add_many(table,
TABLE_EMPTY,