aboutsummaryrefslogtreecommitdiff
path: root/fad-glifc.c
Commit message (Collapse)AuthorAgeFilesLines
* Prefix routines declared in pcap-int.h with pcap_.Guy Harris2023-05-261-1/+1
| | | | | This avoids potential and, in one case (SIMH), actual collisions with names in other libraries or in applications using libpcap.
* Don't use ctype.h macros.Guy Harris2019-08-311-2/+1
| | | | | | | | | | | | | | | Some of them are locale-dependent, and all of them run the risk of failing if you hand them a char with the 8th bit set. Define our own locale-independent macros that can be handed any integral value. Don't include <ctype.h>. This should address the issue in GitHub pull request #839, and should also catch any (highly unlikely) cases in which something other than Boring Old Space And Tab and, sometimes, CR and LF are treated as white space. (No, we don't want FF or VT treated as white space.)
* Pass the "get additional flags" function to the findalldevs helpers.Guy Harris2018-04-301-2/+2
| | | | | This lets us make it a static function - or eliminate it entirely for pcap-null.c.
* Add a routine to format error messages with an errno-based message at the end.Guy Harris2017-11-151-26/+25
| | | | | | | | | | | | | | That routine will use strerror_s() or strerror_r() if available, in a fashion that's thread-safe. Otherwise, it falls back on pcap_strerror(). Use it in both libpcap and rpcapd. Given that we check for errors in strerror_r(), hopefully this will squelch warnings with newer version of GCC and GNU libc; whilst the macOS (and other BSD-flavored?) strerror_r() always fills in a message, that's not required by the Single UNIX Specification, as far as I can tell, so we apparently really *do* need to check for errors.
* Always include <config.h> rather than "config.h".Guy Harris2017-08-181-1/+1
| | | | | | | | This can prevent bizarre failures if, for example, you've done a configuration in the top-level source directory, leaving behind one config.h file, and then do an out-of-tree build in another directory, with different configuration options. This way, we always pick up the same config.h, in the build directory.
* Rename a routine to match find_or_add_if().Guy Harris2017-01-201-1/+1
| | | | Rename add_addr_to_iflist() to add_addr_to_if().
* Pass IFF_ flags to add_addr_to_iflist().Guy Harris2017-01-181-1/+1
| | | | | | | | It's only used on UN*Xes, so it's only used on systems that have IFF_ flags; have add_addr_to_iflist() do the mapping to PCAP_IF_ flags. That restores the workaround for systems lacking IFF_LOOPBACK and the "don't even try" for systems lacking IFF_UP or IFF_RUNNING.
* Have a pcap_if_list_t structure for use by the findalldevs code.Guy Harris2017-01-181-14/+2
| | | | | | | It's not part of the API, but it's an internal structure used by the findalldevs code. Currently, it just has a pointer to the beginning of the list, but it could change in order to speed up the process of adding to the list.
* We forgot to remove the "skip entries" part in 547b1dec.Guy Harris2016-10-151-22/+0
| | | | We removed it from fad-gifc.c, but not from fad-glifc.c.
* Let the platform decide how to check capturable interfaces.Guy Harris2016-06-281-9/+20
| | | | | | | | | | | | | | | | | | | (Git's annoying policy of expecting a short one-line description of every change means that the first line isn't very explanatory.) Make pcap_findalldevs_interfaces() take as an argument a function that's used to check whether an interface can be captured on or not, rather than doing the check by trying to open the device for capturing. This lets pcap_findalldevs() find interfaces even if you don't have permission to capture on them; that way, instead of users saying "why isn't {tcpdump -D, tshark -D, dumpcap -D, Wireshark, etc.} showing me any interfaces?", they'll say "why am I getting a 'you don't have permissions' error when I try to capture on this interface?", which is a better description of the underlying problem. On some platforms, it also avoids a bunch of extra work when getting a list of interfaces.
* Split out the UN*X flags to pcap flags mapping.Guy Harris2016-01-251-1/+2
| | | | | | | | | | | | Add an if_flags_to_pcap_flags() routine to map the interface name (if necessary) and IFF_ flags to PCAP_IF_ flags, and call that in the platform-specific routines. That means that the calls to add to the interface list don't need to use IFF_ flags, which are UN*Xisms. Move the routines that update the interface list to fad-helpers.c, leaving just the legacy APIs in inet.c. Update finalldevstest to print out all the flags.
* Use pcap_snprintf() instead of snprintf().Guy Harris2015-11-031-9/+9
| | | | | | | | | | | On UN*Xes with snprintf(), we just #define pcap_snprintf to snprintf. On UN*Xes without snprintf(), we provide our own, but call it pcap_snprintf(). On Windows, we have a routine that wraps _snprintf(), with C99 semantics (ensuring null termination if the string won't fit), called pcap_snprintf(), and use that.
* Don't exclude interfaces that aren't up.Guy Harris2014-01-101-4/+1
| | | | | | | | | | | On some platforms, you can capture on those interfaces, which might be useful if you want to start a capture before the interface is up, so that the capture starts capturing as soon as it's up. Those interfaces will not appear in the interface list on platforms where you can't open them for capturing, and they'll now be sorted after the interfaces that *are* up, so there's not much harm in including them.
* remove libpcap's own CVS keywordsDenis Ovsienko2014-01-031-5/+0
| | | | | | This change removes CVS keywords that express that the file belongs to libpcap repository. All such keywords represented the revision and timestamp by the end of 2008 or even older.
* Have non-interface modules take responsibility for identifying their devices.Guy Harris2012-06-111-10/+1
| | | | | | | | | | | | | | 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().
* From Sagun Shakya: fix typoes in comments.guy2008-01-301-3/+3
|
* From Albert Chin: fix a cut-and-pasteo.guy2005-04-191-2/+2
|
* Don't ignore Solaris logical interface entries, as they could giveguy2005-01-291-2/+30
| | | | | | additional IP addresses for the underlying interface; instead, strip off the logical interface number, and add them so that the additional addresses are added.
* Add checks for interfaces that begin with "dummy" or that end with ":"guy2005-01-281-1/+34
| | | | | | | | | | | | | 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?).
* Add _U_ to "rcsid[]" definitions, to eliminate "unused variable"guy2003-11-151-2/+2
| | | | warnings from newer versions of GCC.
* Leave it up to the platform-dependent "get interface list" code toguy2002-07-301-2/+5
| | | | | figure out how big the addresses are, as the way that's done is, well, platform-dependent....
* Put the different implementations of "pcap_findalldevs()" into separateguy2002-07-271-0/+322
source files, rather than having a pile of #ifdefs in "inet.c". Add code to the configure script to determine which implementation to use on the platform for which libpcap is being built. Add a "pcap_findalldevs()" implementation for Solaris 8 and later that handles IPv6 addresses.