diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-06-09 19:18:04 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-06-11 08:32:03 +0200 |
commit | 113c0b0d26b2f60c38a605732ce4c0fb3bdfc7dc (patch) | |
tree | 7e284f618447553e9bbf6ae8fdd681a8d50d7bdc /libs/rpcd-mod-luci/src/luci.c | |
parent | f35afea1cbcc3079045cad78cfd91c154fa05a9a (diff) |
rpcd-mod-luci: add link details to ubus netdev information
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'libs/rpcd-mod-luci/src/luci.c')
-rw-r--r-- | libs/rpcd-mod-luci/src/luci.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c index 258d2ec86b..613cea5e73 100644 --- a/libs/rpcd-mod-luci/src/luci.c +++ b/libs/rpcd-mod-luci/src/luci.c @@ -765,6 +765,30 @@ rpc_luci_parse_network_device_sys(const char *name, struct ifaddrs *ifaddr) blobmsg_add_u8(&blob, "pointtopoint", ifa_flags & IFF_POINTOPOINT); blobmsg_close_table(&blob, o2); + o2 = blobmsg_open_table(&blob, "link"); + + p = readstr("/sys/class/net/%s/speed", name); + if (*p) + blobmsg_add_u32(&blob, "speed", atoi(p)); + + p = readstr("/sys/class/net/%s/duplex", name); + if (*p) + blobmsg_add_string(&blob, "duplex", p); + + n = atoi(readstr("/sys/class/net/%s/carrier", name)); + blobmsg_add_u8(&blob, "carrier", n == 1); + + n = atoi(readstr("/sys/class/net/%s/carrier_changes", name)); + blobmsg_add_u32(&blob, "changes", n); + + n = atoi(readstr("/sys/class/net/%s/carrier_up_count", name)); + blobmsg_add_u32(&blob, "up_count", n); + + n = atoi(readstr("/sys/class/net/%s/carrier_down_count", name)); + blobmsg_add_u32(&blob, "down_count", n); + + blobmsg_close_table(&blob, o2); + blobmsg_close_table(&blob, o); } |