diff options
-rw-r--r-- | sys/net/if.h | 6 | ||||
-rw-r--r-- | sys/net/rtsock.c | 6 | ||||
-rw-r--r-- | usr.bin/netstat/if.c | 11 |
3 files changed, 20 insertions, 3 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)); } diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index 46ce775..47f8a1f 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <sys/time.h> +#define _IFI_OQDROPS #include <net/if.h> #include <net/if_var.h> #include <net/if_dl.h> @@ -251,7 +252,7 @@ intpr(int interval, void (*pfunc)(char *), int af) printf(" %10.10s","Obytes"); printf(" %5s", "Coll"); if (dflag) - printf(" %s", "Drop"); + printf(" %s", "Drop"); putchar('\n'); } @@ -382,7 +383,8 @@ intpr(int interval, void (*pfunc)(char *), int af) if (bflag) show_stat("lu", 10, IFA_STAT(obytes), link|network); show_stat("NRSlu", 5, IFA_STAT(collisions), link); - /* XXXGL: output queue drops */ + if (dflag) + show_stat("LSlu", 5, IFA_STAT(oqdrops), link); putchar('\n'); if (!aflag) @@ -460,6 +462,7 @@ struct iftot { u_long ift_id; /* input drops */ u_long ift_op; /* output packets */ u_long ift_oe; /* output errors */ + u_long ift_od; /* output drops */ u_long ift_co; /* collisions */ u_long ift_ib; /* input bytes */ u_long ift_ob; /* output bytes */ @@ -495,6 +498,7 @@ fill_iftot(struct iftot *st) st->ift_ib += IFA_STAT(ibytes); st->ift_op += IFA_STAT(opackets); st->ift_oe += IFA_STAT(oerrors); + st->ift_od += IFA_STAT(oqdrops); st->ift_ob += IFA_STAT(obytes); st->ift_co += IFA_STAT(collisions); } @@ -573,7 +577,8 @@ loop: show_stat("lu", 5, new->ift_oe - old->ift_oe, 1); show_stat("lu", 10, new->ift_ob - old->ift_ob, 1); show_stat("NRSlu", 5, new->ift_co - old->ift_co, 1); - /* XXXGL: output queue drops */ + if (dflag) + show_stat("LSlu", 5, new->ift_od - old->ift_od, 1); putchar('\n'); fflush(stdout); |