Deleted Added
full compact
ip.c (87715) ip.c (158160)
1/*-
2 * Copyright (c) 1980, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
1/*-
2 * Copyright (c) 1980, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
36__FBSDID("$FreeBSD: head/usr.bin/systat/ip.c 87715 2001-12-12 00:13:37Z markm $");
36__FBSDID("$FreeBSD: head/usr.bin/systat/ip.c 158160 2006-04-30 04:26:46Z bde $");
37
38#ifdef lint
39static const char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
40#endif
41
42/* From:
43 "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
44*/

--- 23 unchanged lines hidden (view full) ---

68 struct udpstat u;
69};
70
71static struct stat curstat, initstat, oldstat;
72
73/*-
74--0 1 2 3 4 5 6 7
75--0123456789012345678901234567890123456789012345678901234567890123456789012345
37
38#ifdef lint
39static const char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93";
40#endif
41
42/* From:
43 "Id: mbufs.c,v 1.5 1997/02/24 20:59:03 wollman Exp"
44*/

--- 23 unchanged lines hidden (view full) ---

68 struct udpstat u;
69};
70
71static struct stat curstat, initstat, oldstat;
72
73/*-
74--0 1 2 3 4 5 6 7
75--0123456789012345678901234567890123456789012345678901234567890123456789012345
7601 IP Input IP Output
7702999999999 total packets received 999999999 total packets sent
7803999999999 - with bad checksums 999999999 - generated locally
7904999999999 - too short for header 999999999 - output drops
8005999999999 - too short for data 999999999 output fragments generated
8106999999999 - with invalid hlen 999999999 - fragmentation failed
8207999999999 - with invalid length 999999999 destinations unreachable
8308999999999 - with invalid version 999999999 packets output via raw IP
8409999999999 - jumbograms
8510999999999 total fragments received UDP Statistics
8611999999999 - fragments dropped 999999999 total input packets
8712999999999 - fragments timed out 999999999 - too short for header
8813999999999 - packets reassembled ok 999999999 - invalid checksum
8914999999999 packets forwarded 999999999 - no checksum
9015999999999 - unreachable dests 999999999 - invalid length
9116999999999 - redirects generated 999999999 - no socket for dest port
9217999999999 option errors 999999999 - no socket for broadcast
9318999999999 unwanted multicasts 999999999 - socket buffer full
9419999999999 delivered to upper layer 999999999 total output packets
7600 IP Input IP Output
7701999999999 total packets received 999999999 total packets sent
7802999999999 - with bad checksums 999999999 - generated locally
7903999999999 - too short for header 999999999 - output drops
8004999999999 - too short for data 999999999 output fragments generated
8105999999999 - with invalid hlen 999999999 - fragmentation failed
8206999999999 - with invalid length 999999999 destinations unreachable
8307999999999 - with invalid version 999999999 packets output via raw IP
8408999999999 - jumbograms
8509999999999 total fragments received UDP Statistics
8610999999999 - fragments dropped 999999999 total input packets
8711999999999 - fragments timed out 999999999 - too short for header
8812999999999 - packets reassembled ok 999999999 - invalid checksum
8913999999999 packets forwarded 999999999 - no checksum
9014999999999 - unreachable dests 999999999 - invalid length
9115999999999 - redirects generated 999999999 - no socket for dest port
9216999999999 option errors 999999999 - no socket for broadcast
9317999999999 unwanted multicasts 999999999 - socket buffer full
9418999999999 delivered to upper layer 999999999 total output packets
95--0123456789012345678901234567890123456789012345678901234567890123456789012345
96--0 1 2 3 4 5 6 7
97*/
98
99WINDOW *
100openip(void)
101{
95--0123456789012345678901234567890123456789012345678901234567890123456789012345
96--0 1 2 3 4 5 6 7
97*/
98
99WINDOW *
100openip(void)
101{
102 return (subwin(stdscr, LINES-4-1, 0, 4, 0));
102 return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0));
103}
104
105void
106closeip(w)
107 WINDOW *w;
108{
109 if (w == NULL)
110 return;
111 wclear(w);
112 wrefresh(w);
113 delwin(w);
114}
115
116void
117labelip(void)
118{
119 wmove(wnd, 0, 0); wclrtoeol(wnd);
120#define L(row, str) mvwprintw(wnd, row, 10, str)
121#define R(row, str) mvwprintw(wnd, row, 45, str);
103}
104
105void
106closeip(w)
107 WINDOW *w;
108{
109 if (w == NULL)
110 return;
111 wclear(w);
112 wrefresh(w);
113 delwin(w);
114}
115
116void
117labelip(void)
118{
119 wmove(wnd, 0, 0); wclrtoeol(wnd);
120#define L(row, str) mvwprintw(wnd, row, 10, str)
121#define R(row, str) mvwprintw(wnd, row, 45, str);
122 L(1, "IP Input"); R(1, "IP Output");
123 L(2, "total packets received"); R(2, "total packets sent");
124 L(3, "- with bad checksums"); R(3, "- generated locally");
125 L(4, "- too short for header"); R(4, "- output drops");
126 L(5, "- too short for data"); R(5, "output fragments generated");
127 L(6, "- with invalid hlen"); R(6, "- fragmentation failed");
128 L(7, "- with invalid length"); R(7, "destinations unreachable");
129 L(8, "- with invalid version"); R(8, "packets output via raw IP");
130 L(9, "- jumbograms");
131 L(10, "total fragments received"); R(10, "UDP Statistics");
132 L(11, "- fragments dropped"); R(11, "total input packets");
133 L(12, "- fragments timed out"); R(12, "- too short for header");
134 L(13, "- packets reassembled ok"); R(13, "- invalid checksum");
135 L(14, "packets forwarded"); R(14, "- no checksum");
136 L(15, "- unreachable dests"); R(15, "- invalid length");
137 L(16, "- redirects generated"); R(16, "- no socket for dest port");
138 L(17, "option errors"); R(17, "- no socket for broadcast");
139 L(18, "unwanted multicasts"); R(18, "- socket buffer full");
140 L(19, "delivered to upper layer"); R(19, "total output packets");
122 L(0, "IP Input"); R(0, "IP Output");
123 L(1, "total packets received"); R(1, "total packets sent");
124 L(2, "- with bad checksums"); R(2, "- generated locally");
125 L(3, "- too short for header"); R(3, "- output drops");
126 L(4, "- too short for data"); R(4, "output fragments generated");
127 L(5, "- with invalid hlen"); R(5, "- fragmentation failed");
128 L(6, "- with invalid length"); R(6, "destinations unreachable");
129 L(7, "- with invalid version"); R(7, "packets output via raw IP");
130 L(8, "- jumbograms");
131 L(9, "total fragments received"); R(9, "UDP Statistics");
132 L(10, "- fragments dropped"); R(10, "total input packets");
133 L(11, "- fragments timed out"); R(11, "- too short for header");
134 L(12, "- packets reassembled ok"); R(12, "- invalid checksum");
135 L(13, "packets forwarded"); R(13, "- no checksum");
136 L(14, "- unreachable dests"); R(14, "- invalid length");
137 L(15, "- redirects generated"); R(15, "- no socket for dest port");
138 L(16, "option errors"); R(16, "- no socket for broadcast");
139 L(17, "unwanted multicasts"); R(17, "- socket buffer full");
140 L(18, "delivered to upper layer"); R(18, "total output packets");
141#undef L
142#undef R
143}
144
145static void
146domode(struct stat *ret)
147{
148 const struct stat *sub;

--- 60 unchanged lines hidden (view full) ---

209 u_long totalout;
210
211 domode(&stats);
212 totalout = stats.i.ips_forward + stats.i.ips_localout;
213
214#define DO(stat, row, col) \
215 mvwprintw(wnd, row, col, "%9lu", stats.stat)
216
141#undef L
142#undef R
143}
144
145static void
146domode(struct stat *ret)
147{
148 const struct stat *sub;

--- 60 unchanged lines hidden (view full) ---

209 u_long totalout;
210
211 domode(&stats);
212 totalout = stats.i.ips_forward + stats.i.ips_localout;
213
214#define DO(stat, row, col) \
215 mvwprintw(wnd, row, col, "%9lu", stats.stat)
216
217 DO(i.ips_total, 2, 0);
218 mvwprintw(wnd, 2, 35, "%9lu", totalout);
219 DO(i.ips_badsum, 3, 0);
220 DO(i.ips_localout, 3, 35);
221 DO(i.ips_tooshort, 4, 0);
222 DO(i.ips_odropped, 4, 35);
223 DO(i.ips_toosmall, 5, 0);
224 DO(i.ips_ofragments, 5, 35);
225 DO(i.ips_badhlen, 6, 0);
226 DO(i.ips_cantfrag, 6, 35);
227 DO(i.ips_badlen, 7, 0);
228 DO(i.ips_noroute, 7, 35);
229 DO(i.ips_badvers, 8, 0);
230 DO(i.ips_rawout, 8, 35);
231 DO(i.ips_toolong, 9, 0);
232 DO(i.ips_fragments, 10, 0);
233 DO(i.ips_fragdropped, 11, 0);
234 DO(u.udps_ipackets, 11, 35);
235 DO(i.ips_fragtimeout, 12, 0);
236 DO(u.udps_hdrops, 12, 35);
237 DO(i.ips_reassembled, 13, 0);
238 DO(u.udps_badsum, 13, 35);
239 DO(i.ips_forward, 14, 0);
240 DO(u.udps_nosum, 14, 35);
241 DO(i.ips_cantforward, 15, 0);
242 DO(u.udps_badlen, 15, 35);
243 DO(i.ips_redirectsent, 16, 0);
244 DO(u.udps_noport, 16, 35);
245 DO(i.ips_badoptions, 17, 0);
246 DO(u.udps_noportbcast, 17, 35);
247 DO(i.ips_notmember, 18, 0);
248 DO(u.udps_fullsock, 18, 35);
249 DO(i.ips_delivered, 19, 0);
250 DO(u.udps_opackets, 19, 35);
217 DO(i.ips_total, 1, 0);
218 mvwprintw(wnd, 1, 35, "%9lu", totalout);
219 DO(i.ips_badsum, 2, 0);
220 DO(i.ips_localout, 2, 35);
221 DO(i.ips_tooshort, 3, 0);
222 DO(i.ips_odropped, 3, 35);
223 DO(i.ips_toosmall, 4, 0);
224 DO(i.ips_ofragments, 4, 35);
225 DO(i.ips_badhlen, 5, 0);
226 DO(i.ips_cantfrag, 5, 35);
227 DO(i.ips_badlen, 6, 0);
228 DO(i.ips_noroute, 6, 35);
229 DO(i.ips_badvers, 7, 0);
230 DO(i.ips_rawout, 7, 35);
231 DO(i.ips_toolong, 8, 0);
232 DO(i.ips_fragments, 9, 0);
233 DO(i.ips_fragdropped, 10, 0);
234 DO(u.udps_ipackets, 10, 35);
235 DO(i.ips_fragtimeout, 11, 0);
236 DO(u.udps_hdrops, 11, 35);
237 DO(i.ips_reassembled, 12, 0);
238 DO(u.udps_badsum, 12, 35);
239 DO(i.ips_forward, 13, 0);
240 DO(u.udps_nosum, 13, 35);
241 DO(i.ips_cantforward, 14, 0);
242 DO(u.udps_badlen, 14, 35);
243 DO(i.ips_redirectsent, 15, 0);
244 DO(u.udps_noport, 15, 35);
245 DO(i.ips_badoptions, 16, 0);
246 DO(u.udps_noportbcast, 16, 35);
247 DO(i.ips_notmember, 17, 0);
248 DO(u.udps_fullsock, 17, 35);
249 DO(i.ips_delivered, 18, 0);
250 DO(u.udps_opackets, 18, 35);
251#undef DO
252}
253
254int
255initip(void)
256{
257 size_t len;
258 int name[4];

--- 87 unchanged lines hidden ---
251#undef DO
252}
253
254int
255initip(void)
256{
257 size_t len;
258 int name[4];

--- 87 unchanged lines hidden ---