diff options
author | guy <guy> | 2005-01-28 20:33:51 +0000 |
---|---|---|
committer | guy <guy> | 2005-01-28 20:33:51 +0000 |
commit | 738db2cb080c9234942b28edc8d715a2b363e4a3 (patch) | |
tree | 6fbd87fd52def0cbe29db4f0c6339b1d46b52f8a /fad-glifc.c | |
parent | d6d37a1ad0b435abce1b643eb71130a233d0deb6 (diff) |
Add checks for interfaces that begin with "dummy" or that end with ":"
followed by a number; Ethereal has those checks in the code it uses when
not using "pcap_findalldevs()" - I'm not sure what the "dummy" is
checking for (Linux dummy interfaces?), but the ":" followed by a number
are Solaris virtual interfaces (I think that's how it implements
multiple IP addresses per "real" interface, with each additional address
getting a virtual interface; I'm not sure you can open a virtual
interface for capturing, and even if you can you won't, as far as I
know, see any packets other than the one you get for the "real"
interface - should we just ignore the ":{number}" and "add" that
interface so that we add its IP address?).
Diffstat (limited to 'fad-glifc.c')
-rw-r--r-- | fad-glifc.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/fad-glifc.c b/fad-glifc.c index e1ad491d..212643b5 100644 --- a/fad-glifc.c +++ b/fad-glifc.c @@ -34,7 +34,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/fad-glifc.c,v 1.3 2003-11-15 23:23:58 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/fad-glifc.c,v 1.4 2005-01-28 20:33:51 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -89,6 +89,9 @@ pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) struct lifconf ifc; char *buf = NULL; unsigned buf_size; +#ifdef HAVE_SOLARIS + char *p; +#endif struct lifreq ifrflags, ifrnetmask, ifrbroadaddr, ifrdstaddr; struct sockaddr *netmask, *broadaddr, *dstaddr; int ret = 0; @@ -175,6 +178,36 @@ pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) fd = fd4; /* + * Skip entries that begin with "dummy". + * XXX - what are these? Is this Linux-specific? + * Are there platforms on which we shouldn't do this? + */ + if (strncmp(ifrp->lifr_name, "dummy", 5) == 0) + continue; + +#ifdef HAVE_SOLARIS + /* + * Skip entries that have a ":" followed by a number + * at the end - those are Solaris virtual interfaces + * on which you can't capture. + */ + p = strchr(ifrp->lifr_name, ':'); + if (p != NULL) { + /* + * We have a ":"; is it followed by a number? + */ + while (isdigit((unsigned char)*p)) + p++; + if (*p == '\0') { + /* + * All digits after the ":" until the end. + */ + continue; + } + } +#endif + + /* * Get the flags for this interface, and skip it if it's * not up. */ |