diff options
author | Susant Sahani <ssahani@gmail.com> | 2019-05-21 14:14:36 +0200 |
---|---|---|
committer | Susant Sahani <ssahani@gmail.com> | 2019-05-21 14:14:36 +0200 |
commit | 2c73f59b81bc520e16754ef1a71abf9dbe950219 (patch) | |
tree | 08c991763ce377a19dc3488768d88bdf6fe03543 /src/network/networkctl.c | |
parent | sd-netlink: Add netlink property IFLA_MIN_MTU and IFLA_MAX_MTU, (diff) | |
download | systemd-2c73f59b81bc520e16754ef1a71abf9dbe950219.tar.xz systemd-2c73f59b81bc520e16754ef1a71abf9dbe950219.zip |
networkctl: Add support to display min and max MTU
(networkctl)⚡ % ./networkctl status enp0s31f6 ~/tt/networkctl/build
● 4: enp0s31f6
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: n/a (unmanaged)
Path: pci-0000:00:1f.6
Driver: e1000e
Vendor: Intel Corporation
Model: Ethernet Connection (2) I219-LM
HW Address: 8c:16:45:6c:83:b9 (LCFC(HeFei) Electronics Technology co., ltd)
MTU: 1500
Minimum MTU: 68
Maximum MTU: 9000
Diffstat (limited to 'src/network/networkctl.c')
-rw-r--r-- | src/network/networkctl.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 2c6d4c44e1..ddc5c49e25 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -101,9 +101,13 @@ typedef struct LinkInfo { unsigned short iftype; struct ether_addr mac_address; uint32_t mtu; + uint32_t min_mtu; + uint32_t max_mtu; bool has_mac_address:1; bool has_mtu:1; + bool has_min_mtu:1; + bool has_max_mtu:1; } LinkInfo; static int link_info_compare(const LinkInfo *a, const LinkInfo *b) { @@ -157,6 +161,14 @@ static int decode_link(sd_netlink_message *m, LinkInfo *info, char **patterns) { sd_netlink_message_read_u32(m, IFLA_MTU, &info->mtu) >= 0 && info->mtu > 0; + info->has_min_mtu = + sd_netlink_message_read_u32(m, IFLA_MIN_MTU, &info->min_mtu) >= 0 && + info->min_mtu > 0; + + info->has_max_mtu = + sd_netlink_message_read_u32(m, IFLA_MAX_MTU, &info->max_mtu) >= 0 && + info->min_mtu > 0; + return 1; } @@ -779,6 +791,10 @@ static int link_status_one( if (info->has_mtu) printf(" MTU: %" PRIu32 "\n", info->mtu); + if (info->has_min_mtu) + printf(" Minimum MTU: %" PRIu32 "\n", info->min_mtu); + if (info->has_max_mtu) + printf(" Maximum MTU: %" PRIu32 "\n", info->max_mtu); (void) dump_addresses(rtnl, " Address: ", info->ifindex); (void) dump_gateways(rtnl, hwdb, " Gateway: ", info->ifindex); |