summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient/bpf.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2019-03-18 00:00:59 +0000
committerdlg <dlg@openbsd.org>2019-03-18 00:00:59 +0000
commitb57001d2402253b2754c7550188932001fb07564 (patch)
treec6a4cccd021ced73f832459e308ac89cd578f11d /sbin/dhclient/bpf.c
parentextend BIOCSFILDROP so it can be configured to not capture packets. (diff)
downloadwireguard-openbsd-b57001d2402253b2754c7550188932001fb07564.tar.xz
wireguard-openbsd-b57001d2402253b2754c7550188932001fb07564.zip
explicitly use BPF_FILDROP_CAPTURE when configuring BIOCSFILDROP
BIOCSFILDROP used to just be a flag, ie, any non-zero value was treated the same, but i'm changing it so different values do different things. this way the programs should keep working even if i decide to change the values for these macros.
Diffstat (limited to 'sbin/dhclient/bpf.c')
-rw-r--r--sbin/dhclient/bpf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c
index d1aeeaf8ba7..1bb287687fc 100644
--- a/sbin/dhclient/bpf.c
+++ b/sbin/dhclient/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.74 2019/01/05 21:40:44 krw Exp $ */
+/* $OpenBSD: bpf.c,v 1.75 2019/03/18 00:00:59 dlg Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
@@ -183,6 +183,7 @@ configure_bpf_sock(int bpffd)
struct bpf_version v;
struct bpf_program p;
int flag = 1, sz;
+ int fildrop = BPF_FILDROP_CAPTURE;
/* Make sure the BPF version is in range. */
if (ioctl(bpffd, BIOCVERSION, &v) == -1)
@@ -201,7 +202,7 @@ configure_bpf_sock(int bpffd)
if (ioctl(bpffd, BIOCIMMEDIATE, &flag) == -1)
fatal("BIOCIMMEDIATE");
- if (ioctl(bpffd, BIOCSFILDROP, &flag) == -1)
+ if (ioctl(bpffd, BIOCSFILDROP, &fildrop) == -1)
fatal("BIOCSFILDROP");
/* Get the required BPF buffer length from the kernel. */