summaryrefslogtreecommitdiffstats
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2014-04-03 14:58:52 +0000
committerglebius <glebius@FreeBSD.org>2014-04-03 14:58:52 +0000
commit1e3b3008927ebb2708c3f6a87ba9f302ad3c0c66 (patch)
treed76620c8ed34f66eebfaf93f75d9370405df6a6d /sys/net/rtsock.c
parent17127387c5a1f0d46cd2b9b49a68040eff718bab (diff)
downloadFreeBSD-src-1e3b3008927ebb2708c3f6a87ba9f302ad3c0c66.zip
FreeBSD-src-1e3b3008927ebb2708c3f6a87ba9f302ad3c0c66.tar.gz
o Provide a compatibility shim for netstat(1) to obtain output queue
drops via NET_RT_IFLISTL sysctl. The sysctl handler appends oqdrops at the end of struct if_msghdrl, and netstat(1) sees that as an additional field of struct if_data. This allows us to fetch the data keeping ABI and API compatibility. This is direct commit to stable/10. o Merge r263331 from head, to restore printing of queue drops. Sponsored by: Nginx, Inc. Sponsored by: Netflix
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index b65b5eb..bacd393 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -52,6 +52,7 @@
#include <sys/sysctl.h>
#include <sys/systm.h>
+#define _IN_NET_RTSOCK_C
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_llatbl.h>
@@ -105,6 +106,7 @@ struct if_data32 {
uint32_t ifi_hwassist;
int32_t ifi_epoch;
struct timeval32 ifi_lastchange;
+ uint32_t ifi_oqdrops;
};
struct if_msghdr32 {
@@ -1662,6 +1664,7 @@ sysctl_iflist_ifml(struct ifnet *ifp, struct rt_addrinfo *info,
if (carp_get_vhid_p != NULL)
ifm32->ifm_data.ifi_vhid =
(*carp_get_vhid_p)(ifp->if_addr);
+ ifm32->ifm_data.ifi_oqdrops = ifp->if_snd.ifq_drops;
return (SYSCTL_OUT(w->w_req, (caddr_t)ifm32, len));
}
@@ -1679,6 +1682,9 @@ sysctl_iflist_ifml(struct ifnet *ifp, struct rt_addrinfo *info,
if (carp_get_vhid_p != NULL)
ifm->ifm_data.ifi_vhid = (*carp_get_vhid_p)(ifp->if_addr);
+ ifm->ifm_data.ifi_datalen += sizeof(u_long);
+ ifm->ifi_oqdrops = ifp->if_snd.ifq_drops;
+
return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len));
}
OpenPOWER on IntegriCloud