From 3e4d5cd37b778535eff6379076afd11409141fe7 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Tue, 29 Oct 2013 17:38:13 +0000 Subject: [PATCH] Make userland tools honor WITHOUT_PF build option. Tested by: dt71@gmx.com --- contrib/tcpdump/print-ip.c | 2 ++ sbin/ifconfig/Makefile | 2 ++ usr.bin/netstat/Makefile | 4 ++++ usr.bin/netstat/if.c | 8 ++++++-- usr.bin/netstat/main.c | 2 ++ usr.sbin/tcpdump/tcpdump/Makefile | 4 ++-- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/contrib/tcpdump/print-ip.c b/contrib/tcpdump/print-ip.c index bc6cbcca8164..291901f0fc49 100644 --- a/contrib/tcpdump/print-ip.c +++ b/contrib/tcpdump/print-ip.c @@ -483,9 +483,11 @@ ip_print_demux(netdissect_options *ndo, pgm_print(ipds->cp, ipds->len, (const u_char *)ipds->ip); break; +#if defined(HAVE_NET_PFVAR_H) case IPPROTO_PFSYNC: pfsync_ip_print(ipds->cp, ipds->len); break; +#endif default: if (ndo->ndo_nflag==0 && (proto = getprotobynumber(ipds->nh)) != NULL) diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index a98840dde304..a10d1fbc4602 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -40,7 +40,9 @@ LDADD+= -lbsdxml -lsbuf SRCS+= carp.c # SIOC[GS]VH support SRCS+= ifgroup.c # ... +.if ${MK_PF} != "no" SRCS+= ifpfsync.c # pfsync(4) support +.endif SRCS+= ifbridge.c # bridge support SRCS+= iflagg.c # lagg support diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile index 1071f0e97a24..3e250775697d 100644 --- a/usr.bin/netstat/Makefile +++ b/usr.bin/netstat/Makefile @@ -26,6 +26,10 @@ CFLAGS+=-DINET6 CFLAGS+=-DSDP .endif +.if ${MK_PF} != "no" +CFLAGS+=-DPF +.endif + BINGRP= kmem BINMODE=2555 DPADD= ${LIBKVM} ${LIBMEMSTAT} ${LIBUTIL} diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index c0074c016c13..573a75d8248f 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -48,13 +48,15 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include #include #include +#ifdef PF +#include +#include +#endif #include #include @@ -80,6 +82,7 @@ static void sidewaysintpr(int); static char addr_buf[NI_MAXHOST]; /* for getnameinfo() */ #endif +#ifdef PF static const char* pfsyncacts[] = { /* PFSYNC_ACT_CLR */ "clear all request", /* PFSYNC_ACT_INS */ "state insert", @@ -154,6 +157,7 @@ pfsync_stats(u_long off, const char *name, int af1 __unused, int proto __unused) p(pfsyncs_oerrors, "\t\t%ju send error%s\n"); #undef p } +#endif /* PF */ /* * Display a formatted value, or a '-' in the same space. diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index feb97dc0f0d9..d733e9378102 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -214,8 +214,10 @@ struct protox { pim_stats, NULL, "pim", 1, IPPROTO_PIM }, { -1, N_CARPSTAT, 1, NULL, carp_stats, NULL, "carp", 1, 0 }, +#ifdef PF { -1, N_PFSYNCSTAT, 1, NULL, pfsync_stats, NULL, "pfsync", 1, 0 }, +#endif { -1, N_ARPSTAT, 1, NULL, arp_stats, NULL, "arp", 1, 0 }, { -1, -1, 0, NULL, diff --git a/usr.sbin/tcpdump/tcpdump/Makefile b/usr.sbin/tcpdump/tcpdump/Makefile index fe2a001fa0f5..3ec7efd6024d 100644 --- a/usr.sbin/tcpdump/tcpdump/Makefile +++ b/usr.sbin/tcpdump/tcpdump/Makefile @@ -89,7 +89,6 @@ SRCS= addrtoname.c \ print-olsr.c \ print-ospf.c \ print-otv.c \ - print-pfsync.c \ print-pgm.c \ print-pim.c \ print-ppi.c \ @@ -171,7 +170,8 @@ CFLAGS+= -DHAVE_LIBCRYPTO -DHAVE_OPENSSL_EVP_H .endif .if ${MK_PF} != "no" -SRCS+= print-pflog.c +SRCS+= print-pflog.c \ + print-pfsync.c CFLAGS+= -DHAVE_NET_PFVAR_H .endif