diff options
author | Can Erkin Acar <canacar@cvs.openbsd.org> | 2004-05-08 20:23:22 +0000 |
---|---|---|
committer | Can Erkin Acar <canacar@cvs.openbsd.org> | 2004-05-08 20:23:22 +0000 |
commit | 6cb30f8f0f97d92ed8d1afbe5ce63fbb8d602eea (patch) | |
tree | 7b49907d68d189283042112aec68560173b380b5 /usr.sbin/mopd/common | |
parent | de71d62ffc43a7c9a09eb2e7c989a4b993bbadbc (diff) |
Filter bpf writes and lock descriptor. tested by hshoexer@
ok henning@ deraadt@
Diffstat (limited to 'usr.sbin/mopd/common')
-rw-r--r-- | usr.sbin/mopd/common/pf.c | 17 |
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); } |