diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-06-11 13:22:34 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-06-11 13:22:34 -0700 |
commit | 2426611584e9099af5f98d18ef37337df9bef025 (patch) | |
tree | 4a79e50330d0f179362445bab756177565991310 /fad-getad.c | |
parent | 4e14566d51233686b7f4563f0a48a11a3f9eb808 (diff) |
Have non-interface modules take responsibility for identifying their devices.
Have a table of routines to do pcap_create() for devices that aren't
regular network interfaces. Try each of those in succession until one
says "it's mine" (whether it succeeds or fails); if none do, do a
pcap_create() for a regular interface.
Have those routines do more stringent tests of the name - don't just
accept any name that has a particular substring anywhere in it. That
reduces the likelihood of a false match (as happened with the CANbus
module when somebody renamed their Ethernet interface "canopy").
Have the table also include routines for pcap_findalldevs().
Diffstat (limited to 'fad-getad.c')
-rw-r--r-- | fad-getad.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/fad-getad.c b/fad-getad.c index 742ae1fa..f4d5869c 100644 --- a/fad-getad.c +++ b/fad-getad.c @@ -141,11 +141,9 @@ get_sa_len(struct sockaddr *addr) * Returns -1 on error, 0 otherwise. * The list, as returned through "alldevsp", may be null if no interfaces * were up and could be opened. - * - * This is the implementation used on platforms that have "getifaddrs()". */ int -pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) +pcap_findalldevs_interfaces(pcap_if_t **alldevsp, char *errbuf) { pcap_if_t *devlist = NULL; struct ifaddrs *ifap, *ifa; @@ -273,15 +271,6 @@ pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) freeifaddrs(ifap); - if (ret != -1) { - /* - * We haven't had any errors yet; do any platform-specific - * operations to add devices. - */ - if (pcap_platform_finddevs(&devlist, errbuf) < 0) - ret = -1; - } - if (ret == -1) { /* * We had an error; free the list we've been constructing. |