IPv6 data packets with payload or padded bytes received after one with
no Next Header were not being parsed correctly, resulting in NULL PDU.
This commit fixes the IPv6 parser to be compliant with RFC 2460 Section
4.7 by adding a check in the IPv6 constructor to ignore the subsequent
packets if an IPv6 packet contains no Next Header.
Signed-off-by: James Raphael Tiovalen <jamestiotio@gmail.com>
According to the C/C++ Standard, for shift operations, the behavior is undefined if the right operand is equal to the width of the promoted left operand.
On a 64-bit Windows machine, this causes IP addresses 0.0.0.0 and 255.255.255.255 to have the same internal representation, leading to various issues when using a /0 prefix.
On some platforms (like RedHat ones), CMAKE_INSTALL_LIBDIR is set to
`lib64` instead of `lib`. The CMake files should also be installed to
`lib64`, but because CONF_CMAKE_INSTALL_DIR is set unconditionally to
use `lib`, the proper path can't be configured.
This change makes CONF_CMAKE_INSTALL_DIR use the configured
CMAKE_INSTALL_LIBDIR value, which defaults to `lib`.
Using a submodule to download and build GTest is a great approach for
most circumstances, but some may prefer to use the system-provided GTest
if it is available.
This change adds a fallback to using the system's GTest if the submodule
is absent.
Fix `query_route_table()` returning a buffer padded with extra '\0'
bytes because it ignored the buffer size returned by `sysctl()`.
This caused `route_entries()` / `route6_entries()` to fall into an
infinite loop, forever trying to parse a 0-length routing entry.
The MS C++ compiler doesn't seem to understand that a small constant
like 0, although strictly being an integer, will fit perfectly fine
into an 8 bit type so add some safe casts to silence that warning.
If libpcap support has been disabled (LIBTINS_ENABLE_PCAP=OFF)
then the headers requiring that library will not be installed,
but they will still be included from the main tins.h convenience
header.
This fixes that by sorrounding the includes with an #ifdef the
same way it has been done for DOT11 support.