BSD: Provide minimal interface information

Including:
 - MTU
 - Metric
 - RX/TX IRQ Quota

Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
Thomas Graf 2014-12-16 18:30:53 +01:00
parent ea065c5619
commit 0100916a95

View File

@ -163,6 +163,7 @@ sysctl_read(void)
struct element *e, *e_parent = NULL;
struct if_msghdr *ifm, *nextifm;
struct sockaddr_dl *sdl;
char info_buf[64];
ifm = (struct if_msghdr *) next;
if (ifm->ifm_type != RTM_IFINFO)
@ -225,6 +226,18 @@ sysctl_read(void)
attr_update(e, m->attrid, rx, tx, flags);
}
snprintf(info_buf, sizeof(info_buf), "%u", ifm->ifm_data.ifi_mtu);
element_update_info(e, "MTU", info_buf);
snprintf(info_buf, sizeof(info_buf), "%u", ifm->ifm_data.ifi_metric);
element_update_info(e, "Metric", info_buf);
snprintf(info_buf, sizeof(info_buf), "%u", ifm->ifm_data.ifi_recvquota);
element_update_info(e, "RX-Quota", info_buf);
snprintf(info_buf, sizeof(info_buf), "%u", ifm->ifm_data.ifi_xmitquota);
element_update_info(e, "TX-Quota", info_buf);
element_notify_update(e, NULL);
element_lifesign(e, 1);
}