| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
(cherry picked from commit 858a202b939671ad315396b9f09a27a58cfb31ca)
|
|
|
|
|
|
|
| |
The warning was:
./pcap-linux.c:3622:8: warning: unused variable 'protocol'
int protocol = pcap_protocol(handle);
^
|
|
|
|
|
|
|
| |
Don't assume only Linux and Cygwin are using GNU libc; GNU/HURD and
Debian's kFreeBSD do.
(cherry picked from commit 20348670d5f3f8746d85a9892aa312e7591da4de)
|
|
|
|
|
|
|
|
|
|
|
|
| |
./fmtutils.c:114:20: warning: initialization of 'char *' from 'int'
makes pointer from integer without a cast [-Wint-conversion]
114 | char *errstring = strerror_r(errnum, strerror_buf, PCAP_ERRBUF_SIZE);
| ^~~~~~~~~~
CMake executes the test for strerror_r with GNU_SOURCE defined,
but the actual application did not define it.
(cherry picked from commit 004d48aa51a5ec5488f477a7b318459ac1a09e26)
|
|
|
|
| |
[skip ci]
|
|
|
|
| |
This should fix GitHub issue #893.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Take an else clause for which the if clause returns out and put it at
the top level.
Rename activate_mmap() to setup_mmapped(), as it does part, not all, of
the activation process. Put a bit more of that process into it, so it
finishes the process (except for the final "set the protocol so packets
are seen" part).
Add a setup_non_mmapped() routine that finishes the non-memory-mapped
setup process (except for the final "set the protocol so packets are
seen" part).
(backported from commit 769533f18b0f855acf6477841cb01f20b8dfd3a8)
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Again, if ibv_get_device_list() returns a non-null pointer, and sets the
"number of devices" value to 0, we still have to free the list pointed
to by the non-null pointer.
(cherry picked from commit daa83500c5128404c76787996596306e97e6df91)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If ibv_get_device_list() returns null, there's obviously no device list
to free, so we can just return - and, as ibv_free_device_list() is not
guaranteed to do nothing when passed a null pointer and, in fact, will
try to dereference the null pointer, we *must* return without calling
ibv_free_device_list().
However, if it returns a list, but there are no devices in the list, we
still have to free the list - the list is terminated with a null
pointer, so it's not empty.
The loop for adding devices from the list will terminate immediately if
numdev is 0, so don't bother to check whether it's zero, just run the
loop, which will do nothing if numdev is 0, and fall through to free the
device list.
While we're at it, replace a goto with a break that does the same thing.
(cherry picked from commit 3191c8b7bfd08088108e100411541a0a8b9ac936)
|
|
|
|
|
|
| |
[skip ci]
(cherry picked from commit dd508736e4bd6be2b6b7bb1da1020a62c3e2544b)
|
|
|
|
| |
(cherry picked from commit 452002b25de5c2df6ed0855f5e7bc43d918c1a20)
|
|
|
|
|
|
| |
[skip ci]
(cherry picked from commit b262e73dfdda6599b3b08750fcd6ff2a6a5a16c0)
|
|
|
|
|
| |
There's no "bind to a protocol" support in SOCK_PACKET sockets; do that
only for PF_PACKET sockets.
|
|
|
|
|
| |
Add a comment from the original, and always open PF_PACKET sockets with
a protocol of 0 in the activate code path.
|
|
|
|
|
|
| |
This reverts commit 1ce0fdc186ef16ec42fecff9cfcda45010883b3e.
Nice cleanup, but not necessary.
|
|
|
|
| |
(backported from commit 818751a975fbd1894b975c5d5211c361fcb51f22)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using the memory mapped packet receive path on Linux, we find
that if the buffer is "large" we get a number of dropped packets.
This number of packets is roughly proportional to the buffer size.
It turns out that these packets are dropped by the kernel in the time
period between the socket being opened and the ring parameter setup
completing (this is where the kernel has to allocate the buffer memory).
To prevent this, we can open the socket on protocol 0, which the kernel
interprets to mean that we don't want to receive any packets at all (this
is described when opening a memory mapped packet socket for TX only). We
then set the correct protocol once everything is configured.
Signed-off-by: Mark Marshall <mark.marshall@omicronenergy.com>
(backported from commit 97f59a7d035397c7b4f4889ef5657be811b97e7a)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If you can open a PF_PACKET socket, you don't need to fall back on
PF_INET/SOCK_PACKET sockets, and we've already opened that socket by the
time we call iface_bind().
Have iface_bind() return 0 on success and a PCAP_ERROR_ value on
failure. If the bind() call fails with ENODEV, return
PCAP_ERROR_NO_SUCH_DEVICE, otherwise return PCAP_ERROR.
If getsockopt(SO_ERROR) fails, that's an error; if it succeeds, and
supplies a pending error code, that's an error, too.
(cherry picked from commit c3b7d60fc75835dd58f8410a458782aba8e7a360)
|
|
|
|
| |
(cherry picked from commit 78ee739367e0a51e0c15fd5361baa1f113aca9ae)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Define PCAP_TSTAMP_HOST_{LOW,HI}PREC as synced with the system clock;
add a new PCAP_TSTAMP_HOST_HIPREC_UNSYNCED type for high-precision time
stamps not necessarily synced with the system clock.
This should better match Npcap, including a proposed future "high
precision and synced with the system clock" time stamps for Npcap on
Windows 8 and later.
(This may still not match what FreeBSD offers, but at least it removes
an Npcap mismatch.)
(cherry picked from commit bf0a7f8c86b95fc25a441cbc7969b4e2be2cbfaa)
|
|
|
|
| |
(cherry picked from commit c6b316144da97f81c0078d58fceed53fdb67f526)
|
|
|
|
| |
(cherry picked from commit 5c2d0460aa67ebdcf175a04bdefaccc25dda6c75)
|
|
|
|
| |
(cherry picked from commit 9df3a2ff0602c9129407a1f6de677c606ea7c6a5)
|
|
|
|
|
|
|
| |
That way, we don't have to do the check in the individual setdirection
op routines.
(backported from commit ddbd32822b39dd2a5fb452cc1a7e9f5dd351b507)
|
|
|
|
|
|
| |
Just set the "set direction" operation pointer to null.
(cherry picked from commit 108b0eecc5c876c4ce93e60207146add85fc978e)
|
|
|
|
|
|
|
|
| |
If there's a direction indicator in the packets we get, we should allow
the direction to be set and should check it if it's "incoming only" or
"outgoing only". Otherwise, we shouldn't allow the direction to be set.
(cherry picked from commit 25a2cbb98b22171312ec894b906d56af6344dfeb)
|
|
|
|
|
|
|
|
|
|
| |
Say "...on this device" for errors; it may be the OS's capture mechanism
that doesn't support setting the direction, but there may be other
devices on the system that *do* support it.
Check the validity of the direction argument in more places.
(backported from commit 2c2c323c392980edc4a1044f08d9c2889f336dd3)
|
|
|
|
|
|
| |
[skip ci]
(cherry picked from commit 88a0f88dbe73f57b69940d1ede8d0eb375f13095)
|
|
|
|
|
|
| |
[skip ci]
(cherry picked from commit b880df9ac467c6be1f14c94f97418e6848a5c9e5)
|
|
|
|
|
|
|
|
|
| |
Reject direction arguments other than PCAP_D_IN, PCAP_D_OUT, and
PCAP_D_INOUT.
De-nerdify some errors.
(backported from commit f1d640602594a00a507e217defef41b55feb7acb)
|
|
|
|
| |
(backported from commit 0f2aa024f9ddb0e42ee967f928995114380de89b)
|
|
|
|
| |
(cherry picked from commit cd71247239d187a54bb357bdab1275941c02e5ee)
|
|
|
|
|
|
| |
Not doing so causes warnings about inet_ntop() not being declared.
(cherry picked from commit 9d500076696f07f1f8def0466863e03a3fb6a3ce)
|
|
|
|
|
|
|
| |
Check whether that reproduces GitHub issue #877, to see if that
definition fixes it.
(cherry picked from commit a090f9ea4fb23f36472bafbd2bb5b3d8e9a7be33)
|
|
|
|
| |
(cherry picked from commit b6d046190a6598b0d1a0c4db6f347a54876ca8ec)
|
|
|
|
| |
(cherry picked from commit 6906780633de1e39f4c8eeb3efdb75082baba5c8)
|
|
|
|
| |
(cherry picked from commit 05a230e94927df195ce9a05fe97e37f66cfbff0d)
|
|
|
|
|
|
| |
We don't define pcap_fopen_offline() at all on Windows.
(cherry picked from commit 9f205acde230e44c4f3f3215a00cc314037ba064)
|
|
|
|
|
|
| |
[skip ci]
(cherry picked from commit 583efed06071766aa8d2c59c92e4eb5c22852ea9)
|
|
|
|
|
|
|
|
|
|
| |
pcap_fopen_offline() doesn't need to be defined as a function on
Windows.
That's the problem the previous checkin was trying to figure out, so
undo it.
(cherry picked from commit ce4f065ebaedd1a8687edfd47aa51a9233727800)
|
|
|
|
| |
(cherry picked from commit 901e2598bd2e2b83cdd6c190c5a5bfc968999460)
|
|
|
|
| |
(cherry picked from commit 3a0096146960ae89f8407858491c3f6c50260743)
|
|
|
|
| |
(backported from commit de5f2d8a91f6968d1865834001774c0459a6e56f)
|
|
|
|
|
|
|
|
|
| |
Don't try installing the man pages with MinGW if we don't have it.
In the install_manpage_symlink() function, just *assume* we have
LINK_EXECUTABLE.
(cherry picked from commit 15e4e807487729f66a73694d1debdd173e794520)
|
|
|
|
| |
(backported from commit 4abbc3c8e1d79c7c778db0f482dc44517cb75cd4)
|
|
|
|
| |
(cherry picked from commit 82db0ec2feb888981d91d489948b0e75115db309)
|
|
|
|
| |
(cherry picked from commit da66b9835c4f0061b67b3ede8749de35e176a670)
|
|
|
|
|
|
|
|
| |
Trying to figure out how to set CMAKE_MAKE_PROGRAM to force it to look
there for MinGW, and thus to look there for GCC rather than in
C:\MinGW\bin.
(backported from commit 116114176584ea6a17ccef261e2c8531f3246b35)
|