From Jung-uk Kim: add support for new FreeBSD BIOCSDIRECTION ioctl.
This commit is contained in:
parent
3f4d2d894c
commit
0645b2eb1f
1
CREDITS
1
CREDITS
|
@ -52,6 +52,7 @@ Additional people who have contributed patches:
|
|||
John Bankier <jbankier@rainfinity.com>
|
||||
Jon Lindgren <jonl@yubyub.net>
|
||||
Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de>
|
||||
Jung-uk Kim <jkim@FreeBSD.org>
|
||||
Kazushi Sugyo <sugyo@pb.jp.nec.com>
|
||||
Klaus Klein <kleink@netbsd.org>
|
||||
Koryn Grant <koryn@endace.com>
|
||||
|
|
21
pcap-bpf.c
21
pcap-bpf.c
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.86.2.9 2006-01-22 05:28:34 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.86.2.10 2007-03-26 01:38:46 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -1091,9 +1091,22 @@ pcap_setfilter_bpf(pcap_t *p, struct bpf_program *fp)
|
|||
static int
|
||||
pcap_setdirection_bpf(pcap_t *p, pcap_direction_t d)
|
||||
{
|
||||
#ifdef BIOCSSEESENT
|
||||
#if defined(BIOCSDIRECTION)
|
||||
u_int direction;
|
||||
|
||||
direction = (d == PCAP_D_IN) ? BPF_D_IN :
|
||||
((d == PCAP_D_OUT) ? BPF_D_OUT : BPF_D_INOUT);
|
||||
if (ioctl(p->fd, BIOCSDIRECTION, &direction) == -1) {
|
||||
(void) snprintf(p->errbuf, sizeof(p->errbuf),
|
||||
"Cannot set direction to %s: %s",
|
||||
(d == PCAP_D_IN) ? "PCAP_D_IN" :
|
||||
((d == PCAP_D_OUT) ? "PCAP_D_OUT" : "PCAP_D_INOUT"),
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
#elif defined(BIOCSSEESENT)
|
||||
u_int seesent;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We don't support PCAP_D_OUT.
|
||||
|
@ -1103,7 +1116,7 @@ pcap_setdirection_bpf(pcap_t *p, pcap_direction_t d)
|
|||
"Setting direction to PCAP_D_OUT is not supported on BPF");
|
||||
return -1;
|
||||
}
|
||||
#ifdef BIOCSSEESENT
|
||||
|
||||
seesent = (d == PCAP_D_INOUT);
|
||||
if (ioctl(p->fd, BIOCSSEESENT, &seesent) == -1) {
|
||||
(void) snprintf(p->errbuf, sizeof(p->errbuf),
|
||||
|
|
Reference in New Issue