summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dhcpd/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 /usr.sbin/dhcpd/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 'usr.sbin/dhcpd/bpf.c')
-rw-r--r--usr.sbin/dhcpd/bpf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/dhcpd/bpf.c b/usr.sbin/dhcpd/bpf.c
index 784301a5e1b..c47f3812a40 100644
--- a/usr.sbin/dhcpd/bpf.c
+++ b/usr.sbin/dhcpd/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.19 2017/04/19 05:36:12 natano Exp $ */
+/* $OpenBSD: bpf.c,v 1.20 2019/03/18 00:00:59 dlg Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
@@ -175,6 +175,7 @@ if_register_receive(struct interface_info *info)
struct bpf_version v;
struct bpf_program p;
int flag = 1, sz, cmplt = 0;
+ int fildrop = BPF_FILDROP_CAPTURE;
/* Open a BPF device and hang it on this interface... */
info->rfdesc = if_register_bpf(info);
@@ -195,7 +196,7 @@ if_register_receive(struct interface_info *info)
if (ioctl(info->rfdesc, BIOCIMMEDIATE, &flag) == -1)
fatal("Can't set immediate mode on bpf device");
- if (ioctl(info->rfdesc, BIOCSFILDROP, &flag) == -1)
+ if (ioctl(info->rfdesc, BIOCSFILDROP, &fildrop) == -1)
fatal("Can't set filter-drop mode on bpf device");
/* make sure kernel fills in the source ethernet address */