xref: /freebsd/usr.bin/systat/ip.c (revision 9ff712b0f5e27b68efdb47d863ab7ef8ee243a5b)
12938fb78SGarrett Wollman /*-
22938fb78SGarrett Wollman  * Copyright (c) 1980, 1992, 1993
32938fb78SGarrett Wollman  *	The Regents of the University of California.  All rights reserved.
42938fb78SGarrett Wollman  *
52938fb78SGarrett Wollman  * Redistribution and use in source and binary forms, with or without
62938fb78SGarrett Wollman  * modification, are permitted provided that the following conditions
72938fb78SGarrett Wollman  * are met:
82938fb78SGarrett Wollman  * 1. Redistributions of source code must retain the above copyright
92938fb78SGarrett Wollman  *    notice, this list of conditions and the following disclaimer.
102938fb78SGarrett Wollman  * 2. Redistributions in binary form must reproduce the above copyright
112938fb78SGarrett Wollman  *    notice, this list of conditions and the following disclaimer in the
122938fb78SGarrett Wollman  *    documentation and/or other materials provided with the distribution.
132938fb78SGarrett Wollman  * 3. All advertising materials mentioning features or use of this software
142938fb78SGarrett Wollman  *    must display the following acknowledgement:
152938fb78SGarrett Wollman  *	This product includes software developed by the University of
162938fb78SGarrett Wollman  *	California, Berkeley and its contributors.
172938fb78SGarrett Wollman  * 4. Neither the name of the University nor the names of its contributors
182938fb78SGarrett Wollman  *    may be used to endorse or promote products derived from this software
192938fb78SGarrett Wollman  *    without specific prior written permission.
202938fb78SGarrett Wollman  *
212938fb78SGarrett Wollman  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
222938fb78SGarrett Wollman  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
232938fb78SGarrett Wollman  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
242938fb78SGarrett Wollman  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
252938fb78SGarrett Wollman  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
262938fb78SGarrett Wollman  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
272938fb78SGarrett Wollman  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
282938fb78SGarrett Wollman  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
292938fb78SGarrett Wollman  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
302938fb78SGarrett Wollman  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
312938fb78SGarrett Wollman  * SUCH DAMAGE.
322938fb78SGarrett Wollman  */
332938fb78SGarrett Wollman 
349ff712b0SMark Murray #include <sys/cdefs.h>
359ff712b0SMark Murray 
369ff712b0SMark Murray __FBSDID("$FreeBSD$");
379ff712b0SMark Murray 
389ff712b0SMark Murray #ifdef lint
399ff712b0SMark Murray static const char sccsid[] = "@(#)mbufs.c	8.1 (Berkeley) 6/6/93";
409ff712b0SMark Murray #endif
419ff712b0SMark Murray 
422938fb78SGarrett Wollman /* From:
439ff712b0SMark Murray 	"Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
442938fb78SGarrett Wollman */
452938fb78SGarrett Wollman 
462938fb78SGarrett Wollman #include <sys/param.h>
472938fb78SGarrett Wollman #include <sys/types.h>
482938fb78SGarrett Wollman #include <sys/socket.h>
492938fb78SGarrett Wollman #include <sys/sysctl.h>
502938fb78SGarrett Wollman 
512938fb78SGarrett Wollman #include <netinet/in.h>
522938fb78SGarrett Wollman #include <netinet/in_systm.h>
532938fb78SGarrett Wollman #include <netinet/ip.h>
542938fb78SGarrett Wollman #include <netinet/ip_var.h>
552938fb78SGarrett Wollman #include <netinet/udp.h>
562938fb78SGarrett Wollman #include <netinet/udp_var.h>
572938fb78SGarrett Wollman 
582938fb78SGarrett Wollman #include <stdlib.h>
592938fb78SGarrett Wollman #include <string.h>
602938fb78SGarrett Wollman #include <paths.h>
619ff712b0SMark Murray 
622938fb78SGarrett Wollman #include "systat.h"
632938fb78SGarrett Wollman #include "extern.h"
642938fb78SGarrett Wollman #include "mode.h"
652938fb78SGarrett Wollman 
662938fb78SGarrett Wollman struct stat {
672938fb78SGarrett Wollman 	struct ipstat i;
682938fb78SGarrett Wollman 	struct udpstat u;
692938fb78SGarrett Wollman };
702938fb78SGarrett Wollman 
712938fb78SGarrett Wollman static struct stat curstat, initstat, oldstat;
722938fb78SGarrett Wollman 
732938fb78SGarrett Wollman /*-
742938fb78SGarrett Wollman --0         1         2         3         4         5         6         7
752938fb78SGarrett Wollman --0123456789012345678901234567890123456789012345678901234567890123456789012345
762938fb78SGarrett Wollman 01          IP Input                           IP Output
772938fb78SGarrett Wollman 02999999999 total packets received   999999999 total packets sent
782938fb78SGarrett Wollman 03999999999 - with bad checksums     999999999 - generated locally
792938fb78SGarrett Wollman 04999999999 - too short for header   999999999 - output drops
802938fb78SGarrett Wollman 05999999999 - too short for data     999999999 output fragments generated
812938fb78SGarrett Wollman 06999999999 - with invalid hlen      999999999 - fragmentation failed
822938fb78SGarrett Wollman 07999999999 - with invalid length    999999999 destinations unreachable
832938fb78SGarrett Wollman 08999999999 - with invalid version   999999999 packets output via raw IP
842938fb78SGarrett Wollman 09999999999 - jumbograms
852938fb78SGarrett Wollman 10999999999 total fragments received           UDP Statistics
862938fb78SGarrett Wollman 11999999999 - fragments dropped      999999999 total input packets
872938fb78SGarrett Wollman 12999999999 - fragments timed out    999999999 - too short for header
882938fb78SGarrett Wollman 13999999999 - packets reassembled ok 999999999 - invalid checksum
89fb9aaba0SRuslan Ermilov 14999999999 packets forwarded        999999999 - no checksum
90fb9aaba0SRuslan Ermilov 15999999999 - unreachable dests      999999999 - invalid length
91fb9aaba0SRuslan Ermilov 16999999999 - redirects generated    999999999 - no socket for dest port
92fb9aaba0SRuslan Ermilov 17999999999 option errors            999999999 - no socket for broadcast
93fb9aaba0SRuslan Ermilov 18999999999 unwanted multicasts      999999999 - socket buffer full
94fb9aaba0SRuslan Ermilov 19999999999 delivered to upper layer 999999999 total output packets
952938fb78SGarrett Wollman --0123456789012345678901234567890123456789012345678901234567890123456789012345
962938fb78SGarrett Wollman --0         1         2         3         4         5         6         7
972938fb78SGarrett Wollman */
982938fb78SGarrett Wollman 
992938fb78SGarrett Wollman WINDOW *
1002938fb78SGarrett Wollman openip(void)
1012938fb78SGarrett Wollman {
102fb9aaba0SRuslan Ermilov 	return (subwin(stdscr, LINES-4-1, 0, 4, 0));
1032938fb78SGarrett Wollman }
1042938fb78SGarrett Wollman 
1052938fb78SGarrett Wollman void
1062938fb78SGarrett Wollman closeip(w)
1072938fb78SGarrett Wollman 	WINDOW *w;
1082938fb78SGarrett Wollman {
1092938fb78SGarrett Wollman 	if (w == NULL)
1102938fb78SGarrett Wollman 		return;
1112938fb78SGarrett Wollman 	wclear(w);
1122938fb78SGarrett Wollman 	wrefresh(w);
1132938fb78SGarrett Wollman 	delwin(w);
1142938fb78SGarrett Wollman }
1152938fb78SGarrett Wollman 
1162938fb78SGarrett Wollman void
1172938fb78SGarrett Wollman labelip(void)
1182938fb78SGarrett Wollman {
1192938fb78SGarrett Wollman 	wmove(wnd, 0, 0); wclrtoeol(wnd);
1202938fb78SGarrett Wollman #define L(row, str) mvwprintw(wnd, row, 10, str)
1212938fb78SGarrett Wollman #define R(row, str) mvwprintw(wnd, row, 45, str);
1222938fb78SGarrett Wollman 	L(1, "IP Input");			R(1, "IP Output");
1232938fb78SGarrett Wollman 	L(2, "total packets received");		R(2, "total packets sent");
1242938fb78SGarrett Wollman 	L(3, "- with bad checksums");		R(3, "- generated locally");
1252938fb78SGarrett Wollman 	L(4, "- too short for header");		R(4, "- output drops");
1262938fb78SGarrett Wollman 	L(5, "- too short for data");	R(5, "output fragments generated");
1272938fb78SGarrett Wollman 	L(6, "- with invalid hlen");	R(6, "- fragmentation failed");
1282938fb78SGarrett Wollman 	L(7, "- with invalid length");	R(7, "destinations unreachable");
1292938fb78SGarrett Wollman 	L(8, "- with invalid version");	R(8, "packets output via raw IP");
1302938fb78SGarrett Wollman 	L(9, "- jumbograms");
1312938fb78SGarrett Wollman 	L(10, "total fragments received");	R(10, "UDP Statistics");
1322938fb78SGarrett Wollman 	L(11, "- fragments dropped");	R(11, "total input packets");
1332938fb78SGarrett Wollman 	L(12, "- fragments timed out");	R(12, "- too short for header");
1342938fb78SGarrett Wollman 	L(13, "- packets reassembled ok");	R(13, "- invalid checksum");
135fb9aaba0SRuslan Ermilov 	L(14, "packets forwarded");	R(14, "- no checksum");
136fb9aaba0SRuslan Ermilov 	L(15, "- unreachable dests");	R(15, "- invalid length");
137fb9aaba0SRuslan Ermilov 	L(16, "- redirects generated");	R(16, "- no socket for dest port");
138fb9aaba0SRuslan Ermilov 	L(17, "option errors");		R(17, "- no socket for broadcast");
139fb9aaba0SRuslan Ermilov 	L(18, "unwanted multicasts");	R(18, "- socket buffer full");
140fb9aaba0SRuslan Ermilov 	L(19, "delivered to upper layer");	R(19, "total output packets");
1412938fb78SGarrett Wollman #undef L
1422938fb78SGarrett Wollman #undef R
1432938fb78SGarrett Wollman }
1442938fb78SGarrett Wollman 
1452938fb78SGarrett Wollman static void
1462938fb78SGarrett Wollman domode(struct stat *ret)
1472938fb78SGarrett Wollman {
1482938fb78SGarrett Wollman 	const struct stat *sub;
149d22889b8SDavid E. O'Brien 	int divisor = 1;
1502938fb78SGarrett Wollman 
1512938fb78SGarrett Wollman 	switch(currentmode) {
1522938fb78SGarrett Wollman 	case display_RATE:
1532938fb78SGarrett Wollman 		sub = &oldstat;
1542938fb78SGarrett Wollman 		divisor = naptime;
1552938fb78SGarrett Wollman 		break;
1562938fb78SGarrett Wollman 	case display_DELTA:
1572938fb78SGarrett Wollman 		sub = &oldstat;
1582938fb78SGarrett Wollman 		break;
1592938fb78SGarrett Wollman 	case display_SINCE:
1602938fb78SGarrett Wollman 		sub = &initstat;
1612938fb78SGarrett Wollman 		break;
1622938fb78SGarrett Wollman 	default:
1632938fb78SGarrett Wollman 		*ret = curstat;
1642938fb78SGarrett Wollman 		return;
1652938fb78SGarrett Wollman 	}
1662938fb78SGarrett Wollman #define DO(stat) ret->stat = (curstat.stat - sub->stat) / divisor
1672938fb78SGarrett Wollman 	DO(i.ips_total);
1682938fb78SGarrett Wollman 	DO(i.ips_badsum);
1692938fb78SGarrett Wollman 	DO(i.ips_tooshort);
1702938fb78SGarrett Wollman 	DO(i.ips_toosmall);
1712938fb78SGarrett Wollman 	DO(i.ips_badhlen);
1722938fb78SGarrett Wollman 	DO(i.ips_badlen);
1732938fb78SGarrett Wollman 	DO(i.ips_fragments);
1742938fb78SGarrett Wollman 	DO(i.ips_fragdropped);
1752938fb78SGarrett Wollman 	DO(i.ips_fragtimeout);
1762938fb78SGarrett Wollman 	DO(i.ips_forward);
1772938fb78SGarrett Wollman 	DO(i.ips_cantforward);
1782938fb78SGarrett Wollman 	DO(i.ips_redirectsent);
1792938fb78SGarrett Wollman 	DO(i.ips_noproto);
1802938fb78SGarrett Wollman 	DO(i.ips_delivered);
1812938fb78SGarrett Wollman 	DO(i.ips_localout);
1822938fb78SGarrett Wollman 	DO(i.ips_odropped);
1832938fb78SGarrett Wollman 	DO(i.ips_reassembled);
1842938fb78SGarrett Wollman 	DO(i.ips_fragmented);
1852938fb78SGarrett Wollman 	DO(i.ips_ofragments);
1862938fb78SGarrett Wollman 	DO(i.ips_cantfrag);
1872938fb78SGarrett Wollman 	DO(i.ips_badoptions);
1882938fb78SGarrett Wollman 	DO(i.ips_noroute);
1892938fb78SGarrett Wollman 	DO(i.ips_badvers);
1902938fb78SGarrett Wollman 	DO(i.ips_rawout);
1912938fb78SGarrett Wollman 	DO(i.ips_toolong);
1922938fb78SGarrett Wollman 	DO(i.ips_notmember);
1932938fb78SGarrett Wollman 	DO(u.udps_ipackets);
1942938fb78SGarrett Wollman 	DO(u.udps_hdrops);
1952938fb78SGarrett Wollman 	DO(u.udps_badsum);
196fb9aaba0SRuslan Ermilov 	DO(u.udps_nosum);
1972938fb78SGarrett Wollman 	DO(u.udps_badlen);
1982938fb78SGarrett Wollman 	DO(u.udps_noport);
1992938fb78SGarrett Wollman 	DO(u.udps_noportbcast);
2002938fb78SGarrett Wollman 	DO(u.udps_fullsock);
2012938fb78SGarrett Wollman 	DO(u.udps_opackets);
2022938fb78SGarrett Wollman #undef DO
2032938fb78SGarrett Wollman }
2042938fb78SGarrett Wollman 
2052938fb78SGarrett Wollman void
2062938fb78SGarrett Wollman showip(void)
2072938fb78SGarrett Wollman {
2082938fb78SGarrett Wollman 	struct stat stats;
2092938fb78SGarrett Wollman 	u_long totalout;
2102938fb78SGarrett Wollman 
2112938fb78SGarrett Wollman 	domode(&stats);
2122938fb78SGarrett Wollman 	totalout = stats.i.ips_forward + stats.i.ips_localout;
2132938fb78SGarrett Wollman 
2142938fb78SGarrett Wollman #define DO(stat, row, col) \
2152938fb78SGarrett Wollman 	mvwprintw(wnd, row, col, "%9lu", stats.stat)
2162938fb78SGarrett Wollman 
2172938fb78SGarrett Wollman 	DO(i.ips_total, 2, 0);
2182938fb78SGarrett Wollman 	mvwprintw(wnd, 2, 35, "%9lu", totalout);
2192938fb78SGarrett Wollman 	DO(i.ips_badsum, 3, 0);
2202938fb78SGarrett Wollman 	DO(i.ips_localout, 3, 35);
2212938fb78SGarrett Wollman 	DO(i.ips_tooshort, 4, 0);
2222938fb78SGarrett Wollman 	DO(i.ips_odropped, 4, 35);
2232938fb78SGarrett Wollman 	DO(i.ips_toosmall, 5, 0);
2242938fb78SGarrett Wollman 	DO(i.ips_ofragments, 5, 35);
2252938fb78SGarrett Wollman 	DO(i.ips_badhlen, 6, 0);
2262938fb78SGarrett Wollman 	DO(i.ips_cantfrag, 6, 35);
2272938fb78SGarrett Wollman 	DO(i.ips_badlen, 7, 0);
2282938fb78SGarrett Wollman 	DO(i.ips_noroute, 7, 35);
2292938fb78SGarrett Wollman 	DO(i.ips_badvers, 8, 0);
2302938fb78SGarrett Wollman 	DO(i.ips_rawout, 8, 35);
2312938fb78SGarrett Wollman 	DO(i.ips_toolong, 9, 0);
2322938fb78SGarrett Wollman 	DO(i.ips_fragments, 10, 0);
2332938fb78SGarrett Wollman 	DO(i.ips_fragdropped, 11, 0);
2342938fb78SGarrett Wollman 	DO(u.udps_ipackets, 11, 35);
2352938fb78SGarrett Wollman 	DO(i.ips_fragtimeout, 12, 0);
2362938fb78SGarrett Wollman 	DO(u.udps_hdrops, 12, 35);
2372938fb78SGarrett Wollman 	DO(i.ips_reassembled, 13, 0);
2382938fb78SGarrett Wollman 	DO(u.udps_badsum, 13, 35);
2392938fb78SGarrett Wollman 	DO(i.ips_forward, 14, 0);
240fb9aaba0SRuslan Ermilov 	DO(u.udps_nosum, 14, 35);
2412938fb78SGarrett Wollman 	DO(i.ips_cantforward, 15, 0);
242fb9aaba0SRuslan Ermilov 	DO(u.udps_badlen, 15, 35);
2432938fb78SGarrett Wollman 	DO(i.ips_redirectsent, 16, 0);
244fb9aaba0SRuslan Ermilov 	DO(u.udps_noport, 16, 35);
2452938fb78SGarrett Wollman 	DO(i.ips_badoptions, 17, 0);
246fb9aaba0SRuslan Ermilov 	DO(u.udps_noportbcast, 17, 35);
2472938fb78SGarrett Wollman 	DO(i.ips_notmember, 18, 0);
248fb9aaba0SRuslan Ermilov 	DO(u.udps_fullsock, 18, 35);
2492938fb78SGarrett Wollman 	DO(i.ips_delivered, 19, 0);
250fb9aaba0SRuslan Ermilov 	DO(u.udps_opackets, 19, 35);
2512938fb78SGarrett Wollman #undef DO
2522938fb78SGarrett Wollman }
2532938fb78SGarrett Wollman 
2542938fb78SGarrett Wollman int
2552938fb78SGarrett Wollman initip(void)
2562938fb78SGarrett Wollman {
2572938fb78SGarrett Wollman 	size_t len;
2582938fb78SGarrett Wollman 	int name[4];
2592938fb78SGarrett Wollman 
2602938fb78SGarrett Wollman 	name[0] = CTL_NET;
2612938fb78SGarrett Wollman 	name[1] = PF_INET;
2622938fb78SGarrett Wollman 	name[2] = IPPROTO_IP;
2632938fb78SGarrett Wollman 	name[3] = IPCTL_STATS;
2642938fb78SGarrett Wollman 
2652938fb78SGarrett Wollman 	len = 0;
2662938fb78SGarrett Wollman 	if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
2672938fb78SGarrett Wollman 		error("sysctl getting ipstat size failed");
2682938fb78SGarrett Wollman 		return 0;
2692938fb78SGarrett Wollman 	}
2702938fb78SGarrett Wollman 	if (len > sizeof curstat.i) {
2712938fb78SGarrett Wollman 		error("ipstat structure has grown--recompile systat!");
2722938fb78SGarrett Wollman 		return 0;
2732938fb78SGarrett Wollman 	}
2742938fb78SGarrett Wollman 	if (sysctl(name, 4, &initstat.i, &len, 0, 0) < 0) {
2752938fb78SGarrett Wollman 		error("sysctl getting ipstat failed");
2762938fb78SGarrett Wollman 		return 0;
2772938fb78SGarrett Wollman 	}
2782938fb78SGarrett Wollman 	name[2] = IPPROTO_UDP;
2792938fb78SGarrett Wollman 	name[3] = UDPCTL_STATS;
2802938fb78SGarrett Wollman 
2812938fb78SGarrett Wollman 	len = 0;
2822938fb78SGarrett Wollman 	if (sysctl(name, 4, 0, &len, 0, 0) < 0) {
2832938fb78SGarrett Wollman 		error("sysctl getting udpstat size failed");
2842938fb78SGarrett Wollman 		return 0;
2852938fb78SGarrett Wollman 	}
2862938fb78SGarrett Wollman 	if (len > sizeof curstat.u) {
2872938fb78SGarrett Wollman 		error("ipstat structure has grown--recompile systat!");
2882938fb78SGarrett Wollman 		return 0;
2892938fb78SGarrett Wollman 	}
2902938fb78SGarrett Wollman 	if (sysctl(name, 4, &initstat.u, &len, 0, 0) < 0) {
2912938fb78SGarrett Wollman 		error("sysctl getting udpstat failed");
2922938fb78SGarrett Wollman 		return 0;
2932938fb78SGarrett Wollman 	}
2942938fb78SGarrett Wollman 	oldstat = initstat;
2952938fb78SGarrett Wollman 	return 1;
2962938fb78SGarrett Wollman }
2972938fb78SGarrett Wollman 
2982938fb78SGarrett Wollman void
2992938fb78SGarrett Wollman resetip(void)
3002938fb78SGarrett Wollman {
3012938fb78SGarrett Wollman 	size_t len;
3022938fb78SGarrett Wollman 	int name[4];
3032938fb78SGarrett Wollman 
3042938fb78SGarrett Wollman 	name[0] = CTL_NET;
3052938fb78SGarrett Wollman 	name[1] = PF_INET;
3062938fb78SGarrett Wollman 	name[2] = IPPROTO_IP;
3072938fb78SGarrett Wollman 	name[3] = IPCTL_STATS;
3082938fb78SGarrett Wollman 
3092938fb78SGarrett Wollman 	len = sizeof initstat.i;
3102938fb78SGarrett Wollman 	if (sysctl(name, 4, &initstat.i, &len, 0, 0) < 0) {
3112938fb78SGarrett Wollman 		error("sysctl getting ipstat failed");
3122938fb78SGarrett Wollman 	}
3132938fb78SGarrett Wollman 	name[2] = IPPROTO_UDP;
3142938fb78SGarrett Wollman 	name[3] = UDPCTL_STATS;
3152938fb78SGarrett Wollman 
3162938fb78SGarrett Wollman 	len = sizeof initstat.u;
3172938fb78SGarrett Wollman 	if (sysctl(name, 4, &initstat.u, &len, 0, 0) < 0) {
3182938fb78SGarrett Wollman 		error("sysctl getting udpstat failed");
3192938fb78SGarrett Wollman 	}
3202938fb78SGarrett Wollman 	oldstat = initstat;
3212938fb78SGarrett Wollman }
3222938fb78SGarrett Wollman 
3232938fb78SGarrett Wollman void
3242938fb78SGarrett Wollman fetchip(void)
3252938fb78SGarrett Wollman {
3262938fb78SGarrett Wollman 	int name[4];
3272938fb78SGarrett Wollman 	size_t len;
3282938fb78SGarrett Wollman 
3292938fb78SGarrett Wollman 	oldstat = curstat;
3302938fb78SGarrett Wollman 	name[0] = CTL_NET;
3312938fb78SGarrett Wollman 	name[1] = PF_INET;
3322938fb78SGarrett Wollman 	name[2] = IPPROTO_IP;
3332938fb78SGarrett Wollman 	name[3] = IPCTL_STATS;
3342938fb78SGarrett Wollman 	len = sizeof curstat.i;
3352938fb78SGarrett Wollman 
3362938fb78SGarrett Wollman 	if (sysctl(name, 4, &curstat.i, &len, 0, 0) < 0)
3372938fb78SGarrett Wollman 		return;
3382938fb78SGarrett Wollman 	name[2] = IPPROTO_UDP;
3392938fb78SGarrett Wollman 	name[3] = UDPCTL_STATS;
3402938fb78SGarrett Wollman 	len = sizeof curstat.u;
3412938fb78SGarrett Wollman 
3422938fb78SGarrett Wollman 	if (sysctl(name, 4, &curstat.u, &len, 0, 0) < 0)
3432938fb78SGarrett Wollman 		return;
3442938fb78SGarrett Wollman }
3452938fb78SGarrett Wollman 
346