| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This avoids potential and, in one case (SIMH), actual collisions with
names in other libraries or in applications using libpcap.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
| |
This lets us make it a static function - or eliminate it entirely for
pcap-null.c.
|
|
|
|
|
|
|
|
|
| |
Rather than rolling our own autoconf macros to test for the existence of
data types and structure members, use AC_CHECK_TYPES and
AC_CHECK_MEMBERS.
That cleans the configure script code up a bit, and makes it a bit more
like the CMakeLists.txt file.
|
|
|
|
|
|
|
|
| |
Use "macOS" except when referring to versions that came out when it was
still called "Mac OS X" or "OS X". Rename README.macosx to
README.macos.
Update some comments while we're at it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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 add_addr_to_iflist() to add_addr_to_if().
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Define DLT_USB the way we used to, and undefine DLT_MATCHING_MAX before
defining it. (We arguably never should have exported it, as the only
code that should be using it is the LINKTYPE_ <-> DLT_ converting code,
but....)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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 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().
|
|
|
|
|
|
|
|
|
| |
If we have <netpacket/packet.h>, just include that to get stuff such as
struct sockaddr_ll; otherwise, just fall back on the way we used to do
it, with <netpacket/if_packet.h> on LynxOS and <linux/types.h> and
<linux/if_packet.h> on Linux. If we try to include <netpacket/packet.h>
if we have it and <linux/if_packet.h> if we have it, we get collisions
between their different structure definitions and the compile fails.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This set of diffs is required to correct a problem when compiling
libpcap on Solaris 11 due to the assumption that the presence of
AF_PACKET implies certain header files are in certain positions.
The failure (without the patch) is demonstrated as follows:
gcc -O2 -fpic -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -g
-O2 -c ./fad-getad.c
./fad-getad.c:69:27: linux/types.h: No such file or directory
./fad-getad.c:70:31: linux/if_packet.h: No such file or directory
Reviewed-By: Guy Harris <guy@alum.mit.edu>
|
| |
|
|
|
|
| |
puts the if_packet.h header in a different directory from Linux.
|
| |
|
|
|
|
| |
that have them (Linux).
|
|
|
|
|
|
|
|
| |
might be supplied by the OS, and the OS might supply a version that
doesn't check); instead, check for null pointers before doing anything
with the address at all. This also means we don't supply a netmask if
the address is null; that makes sense, as a netmask makes no sense
without an address.
|
|
|
|
| |
warnings from newer versions of GCC.
|
|
|
|
|
| |
passed to it is NULL, as it might be if, for example, the address or the
netmask isn't supplied.
|
| |
|
|
|
|
|
| |
least for those that also have "getifaddrs()", we have to get the size
by looking at the address family.
|
|
|
|
|
|
| |
"getifaddrs()" can be null, so make "SA_LEN()" return 0 if the argument
is null, rather than dereferencing the argument and crashing if it's
null.
|
|
|
|
| |
IFF_ flags.
|
|
|
|
|
| |
figure out how big the addresses are, as the way that's done is, well,
platform-dependent....
|
|
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.
|