summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mopd
diff options
context:
space:
mode:
authorcanacar <canacar@openbsd.org>2004-05-08 20:23:21 +0000
committercanacar <canacar@openbsd.org>2004-05-08 20:23:21 +0000
commit7ff5f9adab33054db878a8d1f64c577b6008cf59 (patch)
treed191cc78aee7c3baa3b5792affacbfa30c3bd51e /usr.sbin/mopd
parentas bloody attempt to document neighbor cloning (diff)
downloadwireguard-openbsd-7ff5f9adab33054db878a8d1f64c577b6008cf59.tar.xz
wireguard-openbsd-7ff5f9adab33054db878a8d1f64c577b6008cf59.zip
Filter bpf writes and lock descriptor. tested by hshoexer@
ok henning@ deraadt@
Diffstat (limited to 'usr.sbin/mopd')
-rw-r--r--usr.sbin/mopd/common/pf.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/mopd/common/pf.c b/usr.sbin/mopd/common/pf.c
index ee72e04e0e0..7a05d3a987d 100644
--- a/usr.sbin/mopd/common/pf.c
+++ b/usr.sbin/mopd/common/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.10 2004/04/14 20:37:28 henning Exp $ */
+/* $OpenBSD: pf.c,v 1.11 2004/05/08 20:23:21 canacar Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -30,7 +30,7 @@
#ifndef LINT
static const char rcsid[] =
- "$OpenBSD: pf.c,v 1.10 2004/04/14 20:37:28 henning Exp $";
+ "$OpenBSD: pf.c,v 1.11 2004/05/08 20:23:21 canacar Exp $";
#endif
#include <stdio.h>
@@ -151,6 +151,19 @@ pfInit(char *interface, int mode, u_short protocol, int typ)
syslog(LOG_ERR,"pfInit: BIOCSETF: %m");
return (-1);
}
+
+ /* XXX set the same write filter (for protocol only) */
+ if (ioctl(fd, BIOCSETWF, (caddr_t) & filter) < 0) {
+ syslog(LOG_ERR,"pfInit: BIOCSETWF: %m");
+ return (-1);
+ }
+
+ /* Lock the interface to prevent further changes */
+ if (ioctl(fd, BIOCLOCK) < 0) {
+ syslog(LOG_ERR,"pfInit: BIOCLOCK: %m");
+ return (-1);
+ }
+
return (fd);
}