Francois-Xavier Le Bail [Thu, 26 Nov 2015 15:45:42 +0000 (16:45 +0100)]
UDLD: Fix "Unchecked return value" found by Coverity
The bounds check is already done before by ND_TCHECK2(*tptr, len).
So we are deliberately ignoring the return value of fn_printn with last
argument NULL (no bounds check).
Francois-Xavier Le Bail [Fri, 20 Nov 2015 19:23:11 +0000 (20:23 +0100)]
UDLD: Fix an infinite loop
Moreover:
Update reference from draft to RFC5171.
Add bounds and length checks.
Fix TLV length printout. It is the length of the type, length, and value
fields.
Filter out non-printable characters.
Print the Echo TLV with fn_printn(). Note: The format of this list of ID
pairs is not documented in the RFC.
Update the output of a test accordingly.
Add and use istr[] and tstr[] strings.
Comment on the TLV format.
Update some comments.
Guy Harris [Wed, 18 Nov 2015 21:07:34 +0000 (13:07 -0800)]
Squelch a Coverity warning.
See Coverity CID 1324572 for tcpdump - the unsigned octets from the IPv6
address were getting extended to ints as a result of getting shifted
left by an int, so make the loop counter unsigned.
Guy Harris [Wed, 4 Nov 2015 03:06:41 +0000 (19:06 -0800)]
Keep our own Ethertype-to-name map.
Don't use a hack to get the table from libpcap; have our own table.
That cleans up the hack, and lets us add stuff to our table without
having to worry about libpcap.
Francois-Xavier Le Bail [Sat, 17 Oct 2015 20:25:23 +0000 (22:25 +0200)]
ISOCLNS: Fix two segmentation faults
Moreover:
Add/fix a lot of bounds and length checks.
Add and use tstr[] string.
Fix some typos.
Update the output of a test according to these changes.
Luiz Otavio O Souza [Wed, 14 Oct 2015 15:05:24 +0000 (10:05 -0500)]
Fix capsicum support to work with zerocopy buffers in bpf.
Zerocopcy buffers in bpf was broken until recently in FreeBSD and now that
it is fixed, tcpdump is failing with insuficient capabilities when trying to
use the BIOCROTZBUF ioctl.
This commit adds BIOCROTZBUF to the list of allowed ioctls.
Guy Harris [Wed, 7 Oct 2015 07:14:20 +0000 (00:14 -0700)]
Use the nd_uintN_t types more.
Define them in netdissect.h.
Use them in ip.h, and *don't* mark the structures as UNALIGNED; that
should no longer be necessary.
Add a new nd_ipv4 type to use as an IPv4 address; it represents the 4
bytes of IPv4 address as an array of unsigned chars, so that its natural
alignment is only on a byte boundary.
Those changes found some places where we weren't using
UNALIGNED_MEMCPY() to extract IPv4 addresses from packets; use it.
Guy Harris [Tue, 6 Oct 2015 16:41:01 +0000 (09:41 -0700)]
Introduce data types to use for integral values in packet structures.
They are defined as arrays of bytes, so
1) no padding is inserted before them to put them on natural
boundaries, so they can be used if the values *aren't* so
aligned;
2) you have to use EXTRACT_ macros with them - which you should
be doing *anyway*, to avoid explicitly or implicitly making
assumptions about byte order or alignment safety on the
platform for which your code is being built (it'd better work
when built for little-endian x86 or for big-endian *and*
strict-alignment-requiring SPARC).
Use them in the LISP (no, not the programming language!) dissector;
UNALIGNED means "this structure is not guaranteed to be aligned as a
whole, so don't generate code that assumes it is", not "this structure's
individual members shouldn't have padding to put them on natural
boundaries", so it's not sufficient to do that. (Using these types
*might* suffice to ensure that code that assumes alignment not be
generated, but never underestimate SPARC compilers' eagerness to use
single load and store instructions to fetch big-endian 16-bit, 32-bit,
and 64-bit values from packets that really aren't guaranteed to be
aligned.)
Francois-Xavier Le Bail [Mon, 5 Oct 2015 09:03:15 +0000 (11:03 +0200)]
LISP: Fix a Clang warning
The warning was:
./print-lisp.c:401:11: warning: variable 'xtr_present' is used uninitialized
whenever 'if' condition is false [-Wsometimes-uninitialized]
else if (type == LISP_MAP_NOTIFY)
^~~~~~~~~~~~~~~~~~~~~~~
./print-lisp.c:404:9: note: uninitialized use occurs here
return xtr_present;
^~~~~~~~~~~
Guy Harris [Tue, 29 Sep 2015 08:15:53 +0000 (01:15 -0700)]
We need -Werror when testing whether -f or -m flags work.
Thank you, clang, for treating unknown -f flags as warnings, only
failing with them if run with -Werror, and spewing out warning messages
whenever they're used.
Guy Harris [Tue, 29 Sep 2015 01:19:31 +0000 (18:19 -0700)]
If we have the MCS field, it's 11n.
Pass print_chaninfo() the presence flags, and, if IEEE80211_RADIOTAP_MCS
is set, report it as 11n, rather than looking at the channel flags to
figure out whether it's FHSS or 11b/11a/11g.
Fix typo while we're at it ("long GI", not "lon GI").
Simon Nicolussi [Mon, 21 Sep 2015 20:12:20 +0000 (22:12 +0200)]
Default to first interface from pcap_findalldevs()
Only call (deprecated) pcap_lookupdev() as a last resort, as it doesn't
necessarily agree with pcap_findalldevs() on the order of interfaces and
the -D and -i options already rely upon the latter function's behaviour.
Adjust the TLV infinite loop check to require the right amount of bytes
for T and L; do it after printing the TLV header so it is easier to
understand what was wrong. Check if the TLV V is within the capture. Use
the new "invalid" exit label to indicate a packet anomaly and add more
checks for the length value into the type-specific case blocks. Print
the domain string with fn_printzp().
Guy Harris [Sat, 19 Sep 2015 00:24:23 +0000 (17:24 -0700)]
Additional Windows cleanups.
Don't import stuff from WinPcap that it really shouldn't be exporting.
Define HAVE_U_INT{N}_T,to suppress definition of intN_t in bittypes.h, as
included by <pcap/pcap.h> on Windows.
Define HAVE_OS_IPV6_SUPPORT if AF_INET6 is defined, so that if we're
building with a VC+SDK combination that defines it and struct in6_addr,
we don't define them ourselves.
Guy Harris [Fri, 18 Sep 2015 19:39:05 +0000 (12:39 -0700)]
Update Visual Studio files.
Update the list of source files, and the command-line flags (for
example, don't define INET6, as we no longer check it, or WIN32, as we
no longer check it - we check the standard _WIN32 instead).
Guy Harris [Thu, 17 Sep 2015 21:56:44 +0000 (14:56 -0700)]
Don't require IPv6 library support in order to support IPv6 addresses.
Have our own routines to convert between IPv4/IPv6 addresses and
strings; that helps if, for example, we want to build binary versions of
tcpdump for Windows that can run both on NT 5 (W2K/WXP), which doesn't
have inet_ntop() or inet_pton(), and NT 6 (Vista/7/8/10), which do. It
also means that we don't require IPv6 library support on UN*X to print
addresses (if somebody wants to build tcpdump for older UN*Xes lacking
IPv6 support in the system library or in add-on libraries).
Get rid of files in the missing directory that we don't need, and
various no-longer-necessary autoconf tests.
The problem shows itself because 'configure' displays
"checking whether the compiler supports the -Wstrict-prototypes option... no"
even if '-Wstrict-prototypes' option is supported.
Moreover:
Update configure accordingly.
Fix a trailing space.
Even if frontend/backend separation is ongoing, keep coherence between
option name and flag name at the moment.
Option name is 'm', thus s/ndo_sflag/ndo_mflag/.