summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-03-18 00:01:00 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-03-18 00:01:00 +0000
commitf209c610cfed98aeebb3e84271b2fe7103bd48c7 (patch)
treeb6e5e981af0b996dda20e2f04a38c64c1351e2b6 /usr.sbin
parent9433c2156d8e66e2a1eab435bb1e000f80dbbad8 (diff)
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')
-rw-r--r--usr.sbin/dhcpd/bpf.c5
-rw-r--r--usr.sbin/dhcrelay6/bpf.c4
2 files changed, 5 insertions, 4 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 */
diff --git a/usr.sbin/dhcrelay6/bpf.c b/usr.sbin/dhcrelay6/bpf.c
index dbc7098c9a8..4b15e6d1b9d 100644
--- a/usr.sbin/dhcrelay6/bpf.c
+++ b/usr.sbin/dhcrelay6/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.2 2017/04/19 05:36:13 natano Exp $ */
+/* $OpenBSD: bpf.c,v 1.3 2019/03/18 00:00:59 dlg Exp $ */
/* BPF socket interface code, originally contributed by Archie Cobbs. */
@@ -203,7 +203,7 @@ if_register_receive(struct interface_info *info)
fatal("Can't set BPF direction capture");
/* Drop them so they don't go up in the network stack. */
- flag = 1;
+ flag = BPF_FILDROP_CAPTURE;
if (ioctl(info->rfdesc, BIOCSFILDROP, &flag) == -1)
fatal("Can't set BPF filter drop");