]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkctl: Add support to display master device
authorSusant Sahani <ssahani@vmware.com>
Sat, 14 Mar 2020 09:09:48 +0000 (10:09 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 16 Mar 2020 15:32:14 +0000 (00:32 +0900)
src/network/networkctl.c

index 70adf4c73bb2ff4887060f7aff92f389c5539427..5a348ef715e32f9f379cc116b2ae04b8e59bf1eb 100644 (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,