summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/netstat/main.c')
-rw-r--r--usr.bin/netstat/main.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index f3c9563..1a5bc14 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -52,6 +52,8 @@ static const char rcsid[] =
#include <netinet/in.h>
+#include <netgraph/ng_socket.h>
+
#include <ctype.h>
#include <err.h>
#include <errno.h>
@@ -121,6 +123,8 @@ static struct nlist nl[] = {
{ "_ddpstat"},
#define N_DDPCB 26
{ "_ddpcb"},
+#define N_NGSOCKS 27
+ { "_ngsocklist"},
{ "" },
};
@@ -158,6 +162,15 @@ struct protox atalkprotox[] = {
0, 0 }
};
+struct protox netgraphprotox[] = {
+ { N_NGSOCKS, -1, 1, netgraphprotopr,
+ NULL, "ctrl" },
+ { N_NGSOCKS, -1, 1, netgraphprotopr,
+ NULL, "data" },
+ { -1, -1, 0, 0,
+ 0, 0 }
+};
+
struct protox ipxprotox[] = {
{ N_IPX, N_IPXSTAT, 1, ipxprotopr,
ipx_stats, "ipx", 0 },
@@ -218,7 +231,7 @@ main(argc, argv)
char *argv[];
{
register struct protoent *p;
- register struct protox *tp; /* for printing cblocks & stats */
+ register struct protox *tp = NULL; /* for printing cblocks & stats */
int ch;
af = AF_UNSPEC;
@@ -251,6 +264,9 @@ main(argc, argv)
af = AF_UNIX;
else if (strcmp(optarg, "atalk") == 0)
af = AF_APPLETALK;
+ else if (strcmp(optarg, "ng") == 0
+ || strcmp(optarg, "netgraph") == 0)
+ af = AF_NETGRAPH;
#ifdef ISO
else if (strcmp(optarg, "iso") == 0)
af = AF_ISO;
@@ -418,6 +434,9 @@ main(argc, argv)
if (af == AF_APPLETALK || af == AF_UNSPEC)
for (tp = atalkprotox; tp->pr_name; tp++)
printproto(tp, tp->pr_name);
+ if (af == AF_NETGRAPH || af == AF_UNSPEC)
+ for (tp = netgraphprotox; tp->pr_name; tp++)
+ printproto(tp, tp->pr_name);
#ifdef NS
if (af == AF_NS || af == AF_UNSPEC)
for (tp = nsprotox; tp->pr_name; tp++)
OpenPOWER on IntegriCloud