Allow pcap_open_live() to return warnings in ebuf.
This commit is contained in:
parent
42f0938c7c
commit
0cc259467a
10
pcap-bpf.c
10
pcap-bpf.c
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.44 2000-10-28 00:01:28 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.45 2001-04-30 16:10:51 fenner Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -340,9 +340,13 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
|
|||
#endif /* BIOCIMMEDIATE */
|
||||
#endif /* _AIX */
|
||||
|
||||
if (promisc)
|
||||
if (promisc) {
|
||||
/* set promiscuous mode, okay if it fails */
|
||||
(void)ioctl(p->fd, BIOCPROMISC, NULL);
|
||||
if (ioctl(p->fd, BIOCPROMISC, NULL) < 0) {
|
||||
snprintf(ebuf, PCAP_ERRBUF_SIZE, "BIOCPROMISC: %s",
|
||||
pcap_strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) {
|
||||
snprintf(ebuf, PCAP_ERRBUF_SIZE, "BIOCGBLEN: %s",
|
||||
|
|
14
pcap.3
14
pcap.3
|
@ -1,4 +1,4 @@
|
|||
.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.20 2001-03-26 10:21:31 guy Exp $
|
||||
.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.21 2001-04-30 16:10:51 fenner Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1994, 1996, 1997
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -135,10 +135,20 @@ to arrive and to read multiple packets from the OS kernel in one
|
|||
operation. Not all platforms support a read timeout; on platforms that
|
||||
don't, the read timeout is ignored.
|
||||
.I ebuf
|
||||
is used to return error text and is only set when
|
||||
is used to return error or warning text. It will be set to error text when
|
||||
.B pcap_open_live()
|
||||
fails and returns
|
||||
.BR NULL .
|
||||
.I ebuf
|
||||
may also be set to warning text when
|
||||
.B pcap_open_live()
|
||||
succeds; to detect this case the caller should store a zero-length string in
|
||||
.I ebuf
|
||||
before calling
|
||||
.B pcap_open_live()
|
||||
and display the warning to the user if
|
||||
.I ebuf
|
||||
is no longer a zero-length string.
|
||||
.PP
|
||||
.B pcap_open_dead()
|
||||
is used for creating a
|
||||
|
|
Reference in New Issue