]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkctl: Display MTU
authorSusant Sahani <ssahani@gmail.com>
Tue, 21 May 2019 11:59:18 +0000 (17:29 +0530)
committerSusant Sahani <ssahani@gmail.com>
Tue, 21 May 2019 11:59:18 +0000 (17:29 +0530)
Now the MTU is not displayed. with this patch it's fixed.

(networkctl)⚡ % ./networkctl status enp0s31f6                                                                                                                          ~/tt/networkctl/build
WARNING: systemd-networkd is not running, output will be incomplete.

● 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

src/network/networkctl.c

index d29eb7d0b20f27647b9026cd79b2f7d0a39dabd1..2c6d4c44e1fe4563c8800775ff7d370f3a8efce4 100644 (file)
@@ -154,7 +154,7 @@ static int decode_link(sd_netlink_message *m, LinkInfo *info, char **patterns) {
                 memcmp(&info->mac_address, &ETHER_ADDR_NULL, sizeof(struct ether_addr)) != 0;
 
         info->has_mtu =
-                sd_netlink_message_read_u32(m, IFLA_MTU, &info->mtu) &&
+                sd_netlink_message_read_u32(m, IFLA_MTU, &info->mtu) >= 0 &&
                 info->mtu > 0;
 
         return 1;