Use the cloning device if that is available
This commit is contained in:
parent
9ab78e153b
commit
f63af1b624
19
dist/ipf/ipsend/sbpf.c
vendored
19
dist/ipf/ipsend/sbpf.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sbpf.c,v 1.4 2004/03/28 09:00:56 martti Exp $ */
|
||||
/* $NetBSD: sbpf.c,v 1.5 2004/12/01 23:49:27 christos Exp $ */
|
||||
|
||||
/*
|
||||
* (C)opyright 1995-1998 Darren Reed. (from tcplog)
|
||||
@ -38,6 +38,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <paths.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
@ -63,8 +64,21 @@ int tout;
|
||||
struct bpf_version bv;
|
||||
struct timeval to;
|
||||
struct ifreq ifr;
|
||||
|
||||
#ifndef _PATH_BPF
|
||||
const char *bpfname = _PATH_BPF;
|
||||
int fd;
|
||||
|
||||
if ((fd = open(bpfname, O_RDWR)) < 0)
|
||||
{
|
||||
fprintf(stderr, "no bpf devices available (%s)\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
int fd = 0;
|
||||
char bpfname[16];
|
||||
int fd = 0, i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
@ -77,6 +91,7 @@ int tout;
|
||||
fprintf(stderr, "no bpf devices available as /dev/bpfxx\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user