Make bpf use the cloning device

This commit is contained in:
christos 2004-12-01 23:51:36 +00:00
parent f63af1b624
commit d1f40c5512

16
dist/ipf/ipsd/sbpf.c vendored
View File

@ -1,4 +1,4 @@
/* $NetBSD: sbpf.c,v 1.2 2002/01/24 08:21:38 martti Exp $ */
/* $NetBSD: sbpf.c,v 1.3 2004/12/01 23:51:36 christos Exp $ */
/*
* (C)opyright 1995-1998 Darren Reed. (from tcplog)
@ -11,6 +11,7 @@
#include <ctype.h>
#include <signal.h>
#include <errno.h>
#include <paths.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/mbuf.h>
@ -123,8 +124,18 @@ int tout;
struct bpf_version bv;
struct timeval to;
struct ifreq ifr;
#ifdef _PATH_BPF
int fd;
const char *bpfname = _PATH_BPF;
if ((fd = open(bpfname, O_RDWR)) < 0)
{
fprintf(stderr, "no bpf devices available (%s)\n",
strerror(errno));
return -1;
}
#else
char bpfname[16];
int fd, i;
int fd = 0, i;
for (i = 0; i < 16; i++)
{
@ -137,6 +148,7 @@ int tout;
fprintf(stderr, "no bpf devices available as /dev/bpfxx\n");
return -1;
}
#endif
if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0)
{