| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
There's no good run-time test, so we test at configure time, by checking
whether /usr/include/inet/ipnet.h exists and contains IPNET_ANY_LINK.
See https://github.com/the-tcpdump-group/tcpdump/issues/1057#issuecomment-1584088911
We make a common routine to use to add that device.
|
|
|
|
|
| |
SINIX went extinct 15-20 years ago. Eliminate an AC_TRY_COMPILE warning
from Autoconf 2.71.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The directory to scan is just /dev, which is wired into the udev source,
at least in the systemd source tree. Just scan that directory, rather
than using using udevinfo to find out the directory. (If there is ever
a reason to look anywhere there than /dev for the usbmon devices - and,
if so, there had better be a good reason, as stuffing special files
anywhere other than /dev on any UN*X, including Linux, will break
programs that use /dev/null or /dev/tty, among other well-known devices
- then provide a mechanism that works at *run time*, so that it works
even for cross-builds libpcap, and that works regardless of whether the
machine on which the built version of libpcap has udev and whether it
has udevinfo or udevadm or whatever.)
|
| |
|
|
|
|
|
|
|
|
| |
This reverts commit 74be794fe7b3540999149f976e4a829289ad43ef.
We'll set _WIN32_WINNT to "Windows 7" when building for MinGW, to force
it to give us NdisMediumIP, and then we'll apply the original pull
request to add NdisMediumIP support.
|
|
|
|
|
|
|
|
| |
Packets from an NdisMediumIP being with an IP header, with no link-layer
header preceding it, so say it's DLT_RAW.
It's not defined in SDKs for older versions of Windows, so we have to
check for it with a compile test in CMake.
|
|
|
|
|
|
|
|
| |
Not all compilers that are used to compile code to run on Linux have
these builtins. For example, older versions of GCC don't, and at least
some people are doing cross-builds for MIPS with older versions of GCC.
This should fix GitHub issue #1003.
|
|
|
|
|
|
| |
If, when building for WinPcap/Npcap on Windows, we have
PacketGetTimestampModes(), add support for getting the available time
stamp modes and setting the time stamp mode.
|
|
|
|
|
|
|
|
| |
This lets us build with older versions of DPDK that define struct
ether_addr and ETHER_MAX_JUMBO_FRAME_LEN and newer versions that define
struct rte_ether_addr and RTE_ETHER_MAX_JUMBO_FRAME_LEN.
That addresses the issue in GitHub pull request #921.
|
|
|
|
|
|
|
| |
Version 2 was, apparently, short-lived, and version 1 is source and
binary incompatible with version 3, and it appears that, these days,
everybody's using version 3. We're not supporting older versions of the
Linux kernel; let's drop support for older versions of libnl, too.
|
|
|
|
|
|
|
|
| |
This allows us to update the support for newer APIs in the future - and
in the present, with pcap_set_datalink() - and would allow Npcap to
remove its AirPcap support.
Add another test program, while we're at it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a routine pcap_init() that initializes pcap, specifying whether
strings should be treated as being in UTF-8 or a local character
encoding.
On UN*Xes, we don't change our behavior based on that setting; if there
is ever an issue with local character encodings *other* than UTF-8, we
can use it.
On Windows, the local character encoding is the local ANSI code page; if
pcap_init() isn't called, or is called with PCAP_CHAR_ENC_LOCAL, strings
are treated as being in the current ANSI code page, as before, otherwise
they're treated as being in UTF-8. This includes file path names and
error messages.
In addition, if pcap_init() is called, regardless of the options, we
disable pcap_lookupdev(), making it always return NULL, as it retunred
*UTF-16LE* strings (plural!) on Windows NT, and pcap_create() had to
check for UTF-16LE strings to work around that. That workaround is
unsafe (it will read past the end of the input string if the string is
one ASCII character), and is also disabled if pcap_init() is called.
We also make rpcapd send UTF-8 error message strings over the wire;
sending local code page strings is a Bad Idea, as the client has no idea
what the server's code page is. (Do not assume the client and server
are necessarily in the same location.)
Fix the capitalization of "Winsock" while we're at it; Microsoft appears
to spell it "Winsock", rather than "WinSock".
|
|
|
|
| |
[skip ci]
|
|
|
|
|
| |
It was introduced long before 2.6.27, and we require 2.6.27 or newer, so
we can just assume we have it.
|
|
|
|
| |
We require Linux 2.6.27 or later, and that has ethtool.h.
|
|
|
|
|
| |
We unconditionally include it in pcap-linux.c; don't check for it, and
don't subsequently conditionally include it again.
|
|
|
|
|
| |
We fail to compile if we don't at least have TPACKET_V2 support; if we
have that, we have struct tpacket_stats.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
It's a Linux-specific mechanism; on at least two other platforms,
FreeBSD and macOS, USB sniffing takes place through BPF, so it's not
something that we allow to be disabled.
Clean up the checks for Linux-specific mechanisms, putting them inside a
general "Is this Linux?" test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GNU libc is a pain. If you don't define _GNU_SOURCE, it doesn't declare
asprintf(). If you *do* define _GNU_SOURCE, the strerror_r() it
declares isn't POSIX-compliant.
We use asprintf() if present, so we need it to be declared; define
_GNU_SOURCE in ftmacros.h.
At configuration time, if we have strerror_r(), check whether it's
GNU-style or POSIX-style, and define different #defines for those two
cases. Handle GNU-style strerror_r() and POSIX-style strerror_r()
differently in pcap_fmt_errmsg_for_errno().
Make sure everything that uses asprintf() includes ftmacros.h before
including stdio.h.
|
|
|
|
| |
In cmakeconfig.h.in, you use #cmakedefine, with a value, you don't use
|
|
|
|
|
|
|
|
|
|
|
| |
Add a #cmakedefine for HAVE_CONFIG_HAIKUCONFIG_H and move
PCAP_SUPPORT_DPDK.
This makes it a bit easier to compare the autotools-generated config.h
and the CMake-generated config.h, to make sure the latter is OK
(config.h.in is generated by autoconf, so we don't have to maintain it
ourselves; cmakeconfig.h.in isn't, so we have to maintain it ourselves,
and may make errors).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This lets us get rid of places where we calculate the length that a
formatted string will require, attempt to allocate a buffer for the
string, and then format the string into that buffer; this way, we don't
have to hope we got the calculation correct, we rely on the same code
that formats strings to do the calculation.
Provide versions of asprintf() for:
1) Windows and the MSVC runtime, where we use _vscprintf() to determine
the length;
2) systems that have (what is presumed to be) an snprintf() that, when
handed a too-short buffer, returns the number of characters that would
have been written had the buffer been long enough (as C99 specifies),
where we format to a one-character buffer to determine the length;
3) systems that don't have snprintf(), where we use the asprintf()
provided by the missing/snprintf.c file that also provides snprintf().
While we're at it, include "portability.h" in missing/win_snprintf.c, to
get declaration/definition checking done.
|
|
|
|
| |
Add a copyright notice to rpcapd/log.{c,h} while we're at it.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| | |
It's in C90 (and I think it was in C89); if you don't have it, you have
an environment that's too old, especially given that we require a
C99-capable compiler on UN*X.
|
|/
|
|
| |
On platforms that support it use an eventfd to exit any polling.
|
|
|
|
|
|
|
|
|
| |
Use the same test that extract.h does for processors whose load (and,
for CISC processors, memory-to-register arithmetic) instructions support
unaligned operands.
This gets rid of the last place where we used LBL_ALIGN, so get rid of
it. (We weren't setting it with CMake in any case.)
|
| |
|
|
|
|
|
|
| |
It doesn't enable Linux packet ring support on any platform on which
it's used, it enables packet ring support *on Linux*, and doesn't do
anything on non-Linux platforms.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Always use getaddrinfo() for name-to-address lookups; it's the only
portable API that lets you do those lookups in a thread-safe fashion.
This means we require getaddrinfo(); yes, this leaves older OSes out in
the cold - you'd have to provide your own getaddrinfo() on older OSes
that lack it, just as you now will need to provide versions of Flex and
bison/Berkeley YACC that can support reentrant scanners/parsers on older
OSes that lack it, and compilers capable of supporting some C99 features
on older platforms that lack it.
Try to find reentrant versions of getnetbyname() and getprotobyname();
that's a pain, and, if none are found, we'll just have to hope that the
native versions are thread-safe, which they aren't on NetBSD and
OpenBSD.
|
| |
|
|
|
|
|
|
| |
Instead, use compiler test macros for the one remaining case where we
tested for __attribute__ to check whether that *particular* attribute is
supported.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
With autotools, check for strerror_s(), just in case it's used on
Windows.
With CMake, add HAVE_STRERROR_R and HAVE_STRERROR_S to cmakeconfig.h.in.
|
|
|
|
| |
Solaris doesn't have either of them, so don't assume all UN*Xes do.
|
|
|
|
|
|
|
|
|
|
|
| |
It appears to have the same signature and documented behavior in Linux
and Solaris, so I suspect that, if it exists on a given UN*X, it works
the same way.
We still need to handle password verification on other platforms that
don't store the encrypted password in the publicly-readable(!)
/etc/passwd or another publicly-readable form (i.e., probably just about
every UN*X on the planet, these days) but don't offer getspnam().
|
|
|
|
|
| |
That makes it easier to compare the autotools and cmake config.h when
testing.
|
|
|
|
|
|
| |
HAVE_REMOTE implies that there's some feature in our build environment
that we have, but this is a flag that controls what the user specified
at configuration time.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
It's used, and it's put into config.h with autotools.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
On platforms where the OS's ether_hostton man page says "include this",
include that. However, that doesn't always declare it, so still check
whether it really declares ether_hostton().
Just use AC_CHECK_DECL() to do the checks - that fails either if the
headers in question don't exists or if they exist buf don't end up
declaring ether_hostton().
Check these in CMake as well.
|