main.c (dd335a1577cd534d318504428e89908574c9ba1b) main.c (690f477d75324543e57e2b45354c6e0670b9a5f7)
1/*-
2 * Copyright (c) 1983, 1988, 1993
3 * 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

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

49#include <sys/param.h>
50#include <sys/file.h>
51#include <sys/protosw.h>
52#include <sys/socket.h>
53#include <sys/socketvar.h>
54
55#include <netinet/in.h>
56
1/*-
2 * Copyright (c) 1983, 1988, 1993
3 * 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

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

49#include <sys/param.h>
50#include <sys/file.h>
51#include <sys/protosw.h>
52#include <sys/socket.h>
53#include <sys/socketvar.h>
54
55#include <netinet/in.h>
56
57#ifdef NETGRAPH
57#include <netgraph/ng_socket.h>
58#include <netgraph/ng_socket.h>
59#endif
58
59#include <ctype.h>
60#include <err.h>
61#include <errno.h>
62#include <kvm.h>
63#include <limits.h>
64#include <netdb.h>
65#include <nlist.h>

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

267#endif
268
269struct protox atalkprotox[] = {
270 { N_DDPCB, N_DDPSTAT, 1, atalkprotopr,
271 ddp_stats, NULL, "ddp", 0, 0 },
272 { -1, -1, 0, NULL,
273 NULL, NULL, NULL, 0, 0 }
274};
60
61#include <ctype.h>
62#include <err.h>
63#include <errno.h>
64#include <kvm.h>
65#include <limits.h>
66#include <netdb.h>
67#include <nlist.h>

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

269#endif
270
271struct protox atalkprotox[] = {
272 { N_DDPCB, N_DDPSTAT, 1, atalkprotopr,
273 ddp_stats, NULL, "ddp", 0, 0 },
274 { -1, -1, 0, NULL,
275 NULL, NULL, NULL, 0, 0 }
276};
275
277#ifdef NETGRAPH
276struct protox netgraphprotox[] = {
277 { N_NGSOCKS, -1, 1, netgraphprotopr,
278 NULL, NULL, "ctrl", 0, 0 },
279 { N_NGSOCKS, -1, 1, netgraphprotopr,
280 NULL, NULL, "data", 0, 0 },
281 { -1, -1, 0, NULL,
282 NULL, NULL, NULL, 0, 0 }
283};
278struct protox netgraphprotox[] = {
279 { N_NGSOCKS, -1, 1, netgraphprotopr,
280 NULL, NULL, "ctrl", 0, 0 },
281 { N_NGSOCKS, -1, 1, netgraphprotopr,
282 NULL, NULL, "data", 0, 0 },
283 { -1, -1, 0, NULL,
284 NULL, NULL, NULL, 0, 0 }
285};
284
286#endif
285#ifdef IPX
286struct protox ipxprotox[] = {
287 { N_IPX, N_IPXSTAT, 1, ipxprotopr,
288 ipx_stats, NULL, "ipx", 0, 0 },
289 { N_IPX, N_SPXSTAT, 1, ipxprotopr,
290 spx_stats, NULL, "spx", 0, 0 },
291 { -1, -1, 0, NULL,
292 NULL, NULL, 0, 0, 0 }

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

379#ifdef IPSEC
380 else if (strcmp(optarg, "pfkey") == 0)
381 af = PF_KEY;
382#endif
383 else if (strcmp(optarg, "unix") == 0)
384 af = AF_UNIX;
385 else if (strcmp(optarg, "atalk") == 0)
386 af = AF_APPLETALK;
287#ifdef IPX
288struct protox ipxprotox[] = {
289 { N_IPX, N_IPXSTAT, 1, ipxprotopr,
290 ipx_stats, NULL, "ipx", 0, 0 },
291 { N_IPX, N_SPXSTAT, 1, ipxprotopr,
292 spx_stats, NULL, "spx", 0, 0 },
293 { -1, -1, 0, NULL,
294 NULL, NULL, 0, 0, 0 }

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

381#ifdef IPSEC
382 else if (strcmp(optarg, "pfkey") == 0)
383 af = PF_KEY;
384#endif
385 else if (strcmp(optarg, "unix") == 0)
386 af = AF_UNIX;
387 else if (strcmp(optarg, "atalk") == 0)
388 af = AF_APPLETALK;
389#ifdef NETGRAPH
387 else if (strcmp(optarg, "ng") == 0
388 || strcmp(optarg, "netgraph") == 0)
389 af = AF_NETGRAPH;
390 else if (strcmp(optarg, "ng") == 0
391 || strcmp(optarg, "netgraph") == 0)
392 af = AF_NETGRAPH;
393#endif
390 else if (strcmp(optarg, "link") == 0)
391 af = AF_LINK;
392 else {
393 errx(1, "%s: unknown address family", optarg);
394 }
395 break;
396 case 'g':
397 gflag = 1;

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

579 if (af == AF_IPX || af == AF_UNSPEC) {
580 for (tp = ipxprotox; tp->pr_name; tp++)
581 printproto(tp, tp->pr_name);
582 }
583#endif /* IPX */
584 if (af == AF_APPLETALK || af == AF_UNSPEC)
585 for (tp = atalkprotox; tp->pr_name; tp++)
586 printproto(tp, tp->pr_name);
394 else if (strcmp(optarg, "link") == 0)
395 af = AF_LINK;
396 else {
397 errx(1, "%s: unknown address family", optarg);
398 }
399 break;
400 case 'g':
401 gflag = 1;

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

583 if (af == AF_IPX || af == AF_UNSPEC) {
584 for (tp = ipxprotox; tp->pr_name; tp++)
585 printproto(tp, tp->pr_name);
586 }
587#endif /* IPX */
588 if (af == AF_APPLETALK || af == AF_UNSPEC)
589 for (tp = atalkprotox; tp->pr_name; tp++)
590 printproto(tp, tp->pr_name);
591#ifdef NETGRAPH
587 if (af == AF_NETGRAPH || af == AF_UNSPEC)
588 for (tp = netgraphprotox; tp->pr_name; tp++)
589 printproto(tp, tp->pr_name);
592 if (af == AF_NETGRAPH || af == AF_UNSPEC)
593 for (tp = netgraphprotox; tp->pr_name; tp++)
594 printproto(tp, tp->pr_name);
595#endif /* NETGRAPH */
590 if ((af == AF_UNIX || af == AF_UNSPEC) && !Lflag && !sflag)
591 unixpr(nl[N_UNP_COUNT].n_value, nl[N_UNP_GENCNT].n_value,
592 nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value);
593 exit(0);
594}
595
596/*
597 * Print out protocol statistics or control blocks (per sflag).

--- 185 unchanged lines hidden ---
596 if ((af == AF_UNIX || af == AF_UNSPEC) && !Lflag && !sflag)
597 unixpr(nl[N_UNP_COUNT].n_value, nl[N_UNP_GENCNT].n_value,
598 nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value);
599 exit(0);
600}
601
602/*
603 * Print out protocol statistics or control blocks (per sflag).

--- 185 unchanged lines hidden ---