summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2008-09-21 22:02:26 +0000
committersam <sam@FreeBSD.org>2008-09-21 22:02:26 +0000
commit9c3d2ffcdff40754b2207eb84c1ff0843e225c71 (patch)
tree6d0176f734c952569004dea8a4d84a092ced5821 /usr.bin/netstat
parent89ba9c24eeac9215b911c9d51e34a31bac0315de (diff)
downloadFreeBSD-src-9c3d2ffcdff40754b2207eb84c1ff0843e225c71.zip
FreeBSD-src-9c3d2ffcdff40754b2207eb84c1ff0843e225c71.tar.gz
add new build knobs and jigger some existing controls to improve
control over the result of buildworld and installworld; this especially helps packaging systems such as nanobsd Reviewed by: various (posted to arch) MFC after: 1 month
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/Makefile13
-rw-r--r--usr.bin/netstat/main.c10
-rw-r--r--usr.bin/netstat/netstat.h2
3 files changed, 20 insertions, 5 deletions
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile
index c781556..bb73c67 100644
--- a/usr.bin/netstat/Makefile
+++ b/usr.bin/netstat/Makefile
@@ -5,7 +5,7 @@
PROG= netstat
SRCS= if.c inet.c main.c mbuf.c mcast.c mroute.c route.c \
- unix.c atalk.c netgraph.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c
+ unix.c atalk.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c
WARNS?= 3
CFLAGS+=-fno-strict-aliasing
@@ -20,8 +20,15 @@ CFLAGS+=-DINET6
BINGRP= kmem
BINMODE=2555
-DPADD= ${LIBKVM} ${LIBMEMSTAT} ${LIBNETGRAPH} ${LIBUTIL}
-LDADD= -lkvm -lmemstat -lnetgraph -lutil
+DPADD= ${LIBKVM} ${LIBMEMSTAT} ${LIBUTIL}
+LDADD= -lkvm -lmemstat -lutil
+
+.if ${MK_NETGRAPH_SUPPORT} != "no"
+SRCS+= netgraph.c
+DPADD+= ${LIBNETGRAPH}
+LDADD+= -lnetgraph
+CFLAGS+=-DNETGRAPH
+.endif
.if ${MK_IPX_SUPPORT} != "no"
SRCS+= ipx.c
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 3b130b2..1f2f0e1 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -54,7 +54,9 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
+#ifdef NETGRAPH
#include <netgraph/ng_socket.h>
+#endif
#include <ctype.h>
#include <err.h>
@@ -272,7 +274,7 @@ struct protox atalkprotox[] = {
{ -1, -1, 0, NULL,
NULL, NULL, NULL, 0, 0 }
};
-
+#ifdef NETGRAPH
struct protox netgraphprotox[] = {
{ N_NGSOCKS, -1, 1, netgraphprotopr,
NULL, NULL, "ctrl", 0, 0 },
@@ -281,7 +283,7 @@ struct protox netgraphprotox[] = {
{ -1, -1, 0, NULL,
NULL, NULL, NULL, 0, 0 }
};
-
+#endif
#ifdef IPX
struct protox ipxprotox[] = {
{ N_IPX, N_IPXSTAT, 1, ipxprotopr,
@@ -384,9 +386,11 @@ main(int argc, char *argv[])
af = AF_UNIX;
else if (strcmp(optarg, "atalk") == 0)
af = AF_APPLETALK;
+#ifdef NETGRAPH
else if (strcmp(optarg, "ng") == 0
|| strcmp(optarg, "netgraph") == 0)
af = AF_NETGRAPH;
+#endif
else if (strcmp(optarg, "link") == 0)
af = AF_LINK;
else {
@@ -584,9 +588,11 @@ main(int argc, char *argv[])
if (af == AF_APPLETALK || af == AF_UNSPEC)
for (tp = atalkprotox; tp->pr_name; tp++)
printproto(tp, tp->pr_name);
+#ifdef NETGRAPH
if (af == AF_NETGRAPH || af == AF_UNSPEC)
for (tp = netgraphprotox; tp->pr_name; tp++)
printproto(tp, tp->pr_name);
+#endif /* NETGRAPH */
if ((af == AF_UNIX || af == AF_UNSPEC) && !Lflag && !sflag)
unixpr(nl[N_UNP_COUNT].n_value, nl[N_UNP_GENCNT].n_value,
nl[N_UNP_DHEAD].n_value, nl[N_UNP_SHEAD].n_value);
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index 0b7f439..3812e63 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -145,7 +145,9 @@ void nserr_stats(u_long, const char *, int, int);
void atalkprotopr(u_long, const char *, int, int);
void ddp_stats(u_long, const char *, int, int);
+#ifdef NETGRAPH
void netgraphprotopr(u_long, const char *, int, int);
+#endif
void unixpr(u_long, u_long, u_long, u_long);
OpenPOWER on IntegriCloud