summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authormvs <mvs@cvs.openbsd.org>2020-08-28 12:01:49 +0000
committermvs <mvs@cvs.openbsd.org>2020-08-28 12:01:49 +0000
commit74c2c4f31ae41fd11a797fb558f9fcb9bfb5e1e9 (patch)
tree7351c413f365ae614b43d2d0ccb53e0714dc5d0d /sys/net
parent842d73abd18d7ec574fe43b12f07cacce2b129ab (diff)
Add missing #if's to fix build without bpf(4).
ok deraadt@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_gre.c4
-rw-r--r--sys/net/if_pflog.c7
-rw-r--r--sys/net/if_switch.c6
-rw-r--r--sys/net/if_vether.c5
-rw-r--r--sys/net/switchofp.c8
5 files changed, 23 insertions, 7 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 641bd6f14e2..b297b64ad6b 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.159 2020/08/21 22:59:27 kn Exp $ */
+/* $OpenBSD: if_gre.c,v 1.160 2020/08/28 12:01:48 mvs Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -1009,7 +1009,9 @@ gre_input_key(struct mbuf **mp, int *offp, int type, int af, uint8_t otos,
void (*input)(struct ifnet *, struct mbuf *);
struct mbuf *(*patch)(const struct gre_tunnel *, struct mbuf *,
uint8_t *, uint8_t);
+#if NBPFILTER > 0
int bpf_af = AF_UNSPEC; /* bpf */
+#endif
int mcast = 0;
uint8_t itos;
diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c
index 7df774277e4..638f8edd10c 100644
--- a/sys/net/if_pflog.c
+++ b/sys/net/if_pflog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflog.c,v 1.90 2020/08/21 22:59:27 kn Exp $ */
+/* $OpenBSD: if_pflog.c,v 1.91 2020/08/28 12:01:48 mvs Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -48,7 +48,9 @@
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_types.h>
+#if NBPFILTER > 0
#include <net/bpf.h>
+#endif
#include <netinet/in.h>
#include <netinet/ip.h>
@@ -409,6 +411,9 @@ pflog_mtap(caddr_t if_bpf, struct pfloghdr *pfloghdr, struct mbuf *m)
m = pd.m;
KASSERT(m == &mhdr);
copy:
+#if NBPFILTER > 0
bpf_mtap_hdr(if_bpf, pfloghdr, sizeof(*pfloghdr), m,
BPF_DIRECTION_OUT);
+#endif
+ return;
}
diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c
index 57373a4f88c..42a593c3e9c 100644
--- a/sys/net/if_switch.c
+++ b/sys/net/if_switch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_switch.c,v 1.37 2020/07/30 11:32:06 mvs Exp $ */
+/* $OpenBSD: if_switch.c,v 1.38 2020/08/28 12:01:48 mvs Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -1509,6 +1509,7 @@ switch_flow_classifier_dump(struct switch_softc *sc,
int
switch_mtap(caddr_t arg, struct mbuf *m, int dir, uint64_t datapath_id)
{
+#if NBPFILTER > 0
struct dlt_openflow_hdr of;
of.of_datapath_id = htobe64(datapath_id);
@@ -1516,6 +1517,9 @@ switch_mtap(caddr_t arg, struct mbuf *m, int dir, uint64_t datapath_id)
DLT_OPENFLOW_TO_SWITCH : DLT_OPENFLOW_TO_CONTROLLER);
return (bpf_mtap_hdr(arg, (caddr_t)&of, sizeof(of), m, dir));
+#else
+ return (0);
+#endif
}
int
diff --git a/sys/net/if_vether.c b/sys/net/if_vether.c
index dad6e26854d..32e61f72dce 100644
--- a/sys/net/if_vether.c
+++ b/sys/net/if_vether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vether.c,v 1.35 2020/08/21 22:59:27 kn Exp $ */
+/* $OpenBSD: if_vether.c,v 1.36 2020/08/28 12:01:48 mvs Exp $ */
/*
* Copyright (c) 2009 Theo de Raadt
@@ -118,11 +118,12 @@ vether_clone_destroy(struct ifnet *ifp)
void
vetherqstart(struct ifqueue *ifq)
{
- struct ifnet *ifp = ifq->ifq_if;
struct mbuf *m;
while ((m = ifq_dequeue(ifq)) != NULL) {
#if NBPFILTER > 0
+ struct ifnet *ifp = ifq->ifq_if;
+
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif /* NBPFILTER > 0 */
diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c
index 587a9c99d38..ba7ee0df95f 100644
--- a/sys/net/switchofp.c
+++ b/sys/net/switchofp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchofp.c,v 1.76 2019/11/27 17:37:32 akoshibe Exp $ */
+/* $OpenBSD: switchofp.c,v 1.77 2020/08/28 12:01:48 mvs Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -4680,7 +4680,9 @@ swofp_forward_ofs(struct switch_softc *sc, struct switch_flow_classify *swfcl,
int
swofp_input(struct switch_softc *sc, struct mbuf *m)
{
- struct swofp_ofs *swofs = sc->sc_ofs;
+#if NBPFILTER > 0
+ struct swofp_ofs *swofs = sc->sc_ofs;
+#endif
struct ofp_header *oh;
ofp_msg_handler handler;
uint16_t ohlen;
@@ -4722,7 +4724,9 @@ swofp_input(struct switch_softc *sc, struct mbuf *m)
int
swofp_output(struct switch_softc *sc, struct mbuf *m)
{
+#if NBPFILTER > 0
struct swofp_ofs *swofs = sc->sc_ofs;
+#endif
if (sc->sc_swdev == NULL) {
m_freem(m);