Identification examples: tcc-0.9.27, tcc-0.9.28rc
There are currently warnings such as:
print-802_11.c:3317: warning: assignment discards qualifiers from pointer
target type
print-esp.c:373: warning: function might return no value: 'ldp_pdu_print'
So use: TCPDUMP_TAINTED=yes
Works on linux-amd64.
Does not work on linux-armv7l with BUILD_LIBPCAP=yes / CMAKE=yes
(Segmentation fault, libpcap dynamically linked). Works with 0.9.28rc.
TinyCC can be found at https://bellard.org/tcc/,
https://repo.or.cz/r/tinycc.git or as package on some distros.
We already report a warning if the secret is too long; do so if there's
an invalid hex digit in the secret.
See
https://github.com/the-tcpdump-group/tcpdump/pull/1185#issuecomment-2119211162
While we're at it, put the length of the string, in hex-digit pairs,
into a size_t rather than an unsigned int, just in case (it's unlikely
that it will overflow a 32-bit unsigned integer, but...).
This lets us remove a bunch of configure-time and compile-time tests.
Update documentation to reflect this.
WinPcap 4.1.3 is based on libpcap 1.0, but doesn't export all of the new
APIs, so it won't work with code that uses any of the other APIs, which
tcpdump does, so don't test with WinPcap.
Some compilers might not understand the declaration of the ndo_error
member of an netdissect_options as pointing to a function that never
returns; add a /* NOTREACHED */ comment in case they recognize that as a
hint.
This change avoids adding a large number to the packet pointer and
overflow it.
It also avoids the differences between 32-bit and 64-bit printouts.
Example:
32-bit:
NFS request xid 1168185174 80 readdirplus fh / 1441792 bytes @ 1585267068834414592 [|nfs]
---
64-bit:
NFS request xid 1168185174 80 readdirplus [|nfs]
Add a test file.
Update a test output accordingly.
Print "[length < 0] (invalid)" when fragment length is negative.
In this case, e.g. when IPv6 payload length is zero, the 32-bit and
64-bit printouts were different.
Example:
32-bit:
frag (0x80000074:1280|4294967288)
---
64-bit:
frag (0x80000074:1280|18446744073709551608)
Add a test file.
Same result in config.h as with CMake.
Before:
#define NETINET_ETHER_H_DECLARES_ETHER_NTOHOST /**/
After:
#define NETINET_ETHER_H_DECLARES_ETHER_NTOHOST 1
[skip ci]
As Francois-Xavier points it out, my recent commit 5265743 in certain
contexts adds rather than removes compiler warnings:
cc: Sun C 5.12 SunOS_i386 Patch 148918-11 2017/12/13
"tcpdump.c", line 3267: warning: bad message tag: E_DEPRECATED_ATT
"tcpdump.c", line 3307: warning: bad message tag: E_DEPRECATED_ATT
Get Sun C versions right to fix that.
Fix an error on Solaris 10 like:
./mkdep: /opt/solarisstudio12.3/bin/cc -D_STDC_C99=: not found
When configure get some compiler option like:
checking for /opt/solarisstudio12.3/bin/cc option to accept ISO C99...
-D_STDC_C99=
Makefile will contain:
CC = /opt/solarisstudio12.3/bin/cc -D_STDC_C99=
And if we use '-c "$(CC)"' mkdep will set and try to run:
CC="/opt/solarisstudio12.3/bin/cc -D_STDC_C99=", which is incorrect.
Remove the quotes to allow mkdep to set CC with the compiler name and
set flags with the option.
print-sll.c uses HAVE_NET_IF_H, which does not always work right: the
header is in POSIX.1-2001, but the result of if_indextoname() is
irrelevant if the current OS is not Linux, in which case the packet was
captured on a different host because libpcap produces DLT_LINUX_SLL2 on
Linux only. The result can be irrelevant on Linux too, but this does
not have an easy solution.
To reduce the problem space, switch print-sll.c to check for __linux__
instead. In tcpdump.c print the warning about interface names only if
sll2_if_print() would print interface names. Since HAVE_NET_IF_H has no
purpose now, remove the checks for <net/if.h>.
Neither addrtoname.c nor extract.h nor netdissect.h nor print-sll.c
require the header anymore, so do not include it there. Add a missing
conditional include to netdissect.c.
On Windows in a struct timestamp, tv_sec is a long not a 64-bit time_t.
The problem shows:
listening on \Device\NPF_Loopback, link-type NULL (BSD loopback),
snapshot length 262144 bytes
1 [localtime() or gmtime() couldn't convert the date and time].052255
IP 10.0.0.10 > 224.0.0.251: igmp v2 report 224.0.0.251
2 [localtime() or gmtime() couldn't convert the date and time].792000
IP 10.0.0.10.138 > 10.0.0.255.138: NBT UDP PACKET(138)
The warnings with clang-cl were:
util-print.c(253,18): warning: incompatible pointer types passing
'const long *' to parameter of type 'const time_t *'
(aka 'const long long *') [-Wincompatible-pointer-types]
253 | tm = localtime(&tv->tv_sec);
| ^~~~~~~~~~~
util-print.c(255,15): warning: incompatible pointer types passing
'const long *' to parameter of type 'const time_t *'
(aka 'const long long *') [-Wincompatible-pointer-types]
255 | tm = gmtime(&tv->tv_sec);
| ^~~~~~~~~~~
At the time of commit 09b639a in 2015 C99 was not a requirement yet, so
the use of AC_TYPE_UINTPTR_T was necessary. However, CMake since its
introduction in 2018 has not been checking for uintptr_t, which proves
that by now all supported platforms have the type and the Autoconf check
is obsolete.
The strftime() format for that case is slightly different, so add a new
p_ntp_time_fmt() routine that takes a strftime() format, and use that in
ZEP.
That way, we can benefit from any handling of times not fitting in a
time_t being done by the NTP time printing code.
Pull the routine that carves a DOS date/time up and puts it into a
struct tm into the routine that converts the struct tm into a time_t.
Note a place where a DOS date/time might not fit in a 32-bit integral
time_t (DOS dates and times can go past the Y2.038K date/time).
Do the NT FILETIME to time_t conversion as an all-integer operation.
Catch cases where the result doesn't fit into a time_t. (And rename the
routine to speak of it as a FILETIME; that's what it's called.)
Remove <fcntl.h> conditional include from util-print.c.
Historically read_infile() was in util.c and used open(), so needed it.
When part of util.c became util-print.c without read_infile(),
the include was left without need.
Builds using Autotools or CMake generate config.h, thus remove the
'#ifdef HAVE_CONFIG_H'/'#endif'.
Remove also the 'add_definitions(-DHAVE_CONFIG_H)' in CMakeLists.txt.
Make them arrays of nd_byte, rather than uint8_t; they're both unsigned
one-byte values, but nd_byte makes it clearer that they're not arrays of
4 one-byte unsigned integer values.
Do not check that the function is just available: first, it is in C99,
so the check almost certainly is a waste of time; second, the source
requires the function unconditionally; third, the subsequent "snprintf()
is suitable" check implies the "snprintf() is available" part anyway.
Print the new flag using lowercase "e" to avoid confusion with the
existing uppercase flags and "." for ACK. Add/update tests. Document
it in the man page using "AE" as the shorthand.