From 1e3b3008927ebb2708c3f6a87ba9f302ad3c0c66 Mon Sep 17 00:00:00 2001 From: glebius Date: Thu, 3 Apr 2014 14:58:52 +0000 Subject: 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 --- sys/net/if.h | 6 ++++++ sys/net/rtsock.c | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'sys/net') 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 #include +#define _IN_NET_RTSOCK_C #include #include #include @@ -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)); } -- cgit v1.1