diff options
author | guy <guy> | 2004-04-23 05:19:04 +0000 |
---|---|---|
committer | guy <guy> | 2004-04-23 05:19:04 +0000 |
commit | 076135f7df2eb3d419142d3dcff37d2271cc24fd (patch) | |
tree | 6d99fb414c7a6cba5a50e9fffffdc0f44adb8075 /pcap-dlpi.c | |
parent | c4e76ddd83e299f3919067b080893e4c4d83abea (diff) |
On non-HP-UX systems, if we fail to open "/dev/{if}" or "/dev/{if}N"
because neither of them exist, just report that there was no DLPI device
found for "{if}N", so people don't think that they need to fix libpcap
(or the program using it) to look somewhere else for the device - the
problem is probably that they're trying to capture on a loopback device
and the lack of any DLPI device is just a symptom of the fact that the
loopback device, at least on Solaris, appears not to support DLPI and
thus isn't supported by libpcap....
Diffstat (limited to 'pcap-dlpi.c')
-rw-r--r-- | pcap-dlpi.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/pcap-dlpi.c b/pcap-dlpi.c index c18e01da..de0dd359 100644 --- a/pcap-dlpi.c +++ b/pcap-dlpi.c @@ -62,7 +62,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.101 2004-04-07 07:56:05 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.102 2004-04-23 05:19:04 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -554,8 +554,28 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, /* Try again with unit number */ if ((p->fd = open(dname2, O_RDWR)) < 0) { - snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s", dname2, - pcap_strerror(errno)); + if (errno == ENOENT) { + /* + * We just report "No DLPI device found" + * with the device name, so people don't + * get confused and think, for example, + * that if they can't capture on "lo0" + * on Solaris the fix is to change libpcap + * (or the application that uses it) to + * look for something other than "/dev/lo0", + * as the fix is to look for an operating + * system other than Solaris - you just + * *can't* capture on a loopback interface + * on Solaris, the lack of a DLPI device + * for the loopback interface is just a + * symptom of that inability. + * + snprintf(ebuf, PCAP_ERRBUF_SIZE, + "%s: No DLPI device found", device); + } else { + snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s", + dname2, pcap_strerror(errno)); + } goto bad; } /* XXX Assume unit zero */ |