diff options
author | glebius <glebius@FreeBSD.org> | 2014-04-03 14:58:52 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2014-04-03 14:58:52 +0000 |
commit | 1e3b3008927ebb2708c3f6a87ba9f302ad3c0c66 (patch) | |
tree | d76620c8ed34f66eebfaf93f75d9370405df6a6d /sys | |
parent | 17127387c5a1f0d46cd2b9b49a68040eff718bab (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/net/if.h | 6 | ||||
-rw-r--r-- | sys/net/rtsock.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/net/if.h b/sys/net/if.h index 80a7112..450f3a5 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -106,6 +106,9 @@ struct if_data { uint64_t ifi_hwassist; /* HW offload capabilities, see IFCAP */ time_t ifi_epoch; /* uptime at attach or stat reset */ struct timeval ifi_lastchange; /* time of last administrative change */ +#ifdef _IFI_OQDROPS + u_long ifi_oqdrops; /* dropped on output */ +#endif }; /*- @@ -283,6 +286,9 @@ struct if_msghdrl { u_short ifm_len; /* length of if_msghdrl incl. if_data */ u_short ifm_data_off; /* offset of if_data from beginning */ struct if_data ifm_data;/* statistics and other data about if */ +#ifdef _IN_NET_RTSOCK_C + u_long ifi_oqdrops; +#endif }; /* 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)); } |