Guy Harris [Thu, 14 Jul 2016 00:23:59 +0000 (17:23 -0700)]
Allow building with libcrypto not in the default directory.
Add support for an argument to --with-crypto, so that if you have one
version of libcrypto installed under /usr and another version installed
under /usr/local, you can force tcpdump to be built with the /usr/local
version.
Also, refer both to OpenSSL and libressl in comments and messages.
Jesse Gross [Fri, 24 Jun 2016 22:45:47 +0000 (15:45 -0700)]
Update list of Geneve option classes.
Newer versions of the Geneve protocol draft have defined additional
option classes. This updates the list so we can show the class name
instead of unknown.
Guy Harris [Fri, 1 Jul 2016 20:58:52 +0000 (13:58 -0700)]
Don't use strcasecmp(), use ascii_strcasecmp().
Not all platforms have strcasecmp() (yes, it's in the Single UNIX
Specification, but not all platforms are UNIX or even UN*X; there's some
obscure company in Redmond, Washington who have an OS on which we run),
and on those that do, there's no guarantee that strcasecmp() will treate
A-Z and a-z as being equivalent ("I" and "i" aren't equivalent in a
Turkish locale, for example).
Guy Harris [Mon, 27 Jun 2016 01:02:12 +0000 (18:02 -0700)]
Squelch a compiler warning.
It may not be necessary, but it makes the code a bit cleaner, even if
you spend a few extra microseconds per file fetching the name of the
link-layer header type even if the new file has the same header type.
Guy Harris [Thu, 23 Jun 2016 04:14:40 +0000 (21:14 -0700)]
Handle OpenSSL 1.1.x.
In 1.1.x, EVP_CIPHER_CTX is an opaque structure, so we can't declare it
on the stack.
Instead, if we don't have EVP_CIPHER_CTX_new() and EVP_CIPHER_CTX_free()
in libcrypto, define our own versions, with the same signatures as the
ones in OpenSSL 1.1.x's libcrypto, and have the code use
EVP_CIPHER_CTX_new() to allocate the structure and EVP_CIPHER_CTX_free()
to free it.
Andrew Darqui [Tue, 12 Jan 2016 17:32:55 +0000 (12:32 -0500)]
Initial support for the REdis Serialization Protocol known as RESP.
This commit adds support for RESP as defined in: http://redis.io/topics/protocol.
It also supports inline commands and pipelining. Due to the popularity of RESP,
numerous services are emerging that use this protocol. You may decode RESP packets
on arbitrary ports using the "-T resp" option.
Example captures can be found in tests/resp_*.
A simple way to test this parser is to start redis-server and then run
redis-cli commands such as "redis-cli set key value".
Traditionally, redis-cli monitor is used to debug redis. Unfortunately,
the "monitor" command can cause significant load on a redis-server in
production. This parser may be used as a non-invasive alternative to
redis-cli monitor.
Guy Harris [Fri, 25 Mar 2016 19:51:08 +0000 (12:51 -0700)]
Clean up version test.
!(nfhdr->nflog_version) is equivalent to (nfhdr->nflog_version == 0).
That will evaluate to 1 if nfhdr->nflog_version is 0 and to 0 otherwise.
So !(nfhdr->nflog_version) == 0 is equivalent to nfhdr->nflog_version != 0,
but 1) it's more obvious what it means and 2) compilers don't point out
that it may not mean what you intended.
Guy Harris [Sun, 20 Mar 2016 22:23:16 +0000 (15:23 -0700)]
Don't recompile the filter if the new file has the same DLT.
Only recompile the filter - and only find a new printer and a new DLT
name - if, when reading multiple files with the -V flag, the new file
has a different DLT value from the old file. With lots of small files,
that can make a significant performance difference.
Guy Harris [Sat, 13 Feb 2016 04:26:39 +0000 (20:26 -0800)]
Don't overwrite the destination IPv6 address for routing headers.
If we have a routing header, instead of overwriting the packet's IPv6
destination address in the packet with the final destination, so that
the next protocol's checksum routine can use it, we do as we do for
IPv4, and, in the "next protocol checksum" routine, scan the headers
looking for a routing header and, if we find one, copy the final
destination from it.
Guy Harris [Tue, 12 Jan 2016 00:14:56 +0000 (16:14 -0800)]
Don't do the DDP-over-UDP heuristic check up front.
There's probably less DDP-over-UDP traffic passing through tcpdump these
days than, for example, SNMP v2 traffic from a low source port longer
than 512 bytes, so move the latter heuristic check after all the other
checks.
Guy Harris [Mon, 11 Jan 2016 23:47:31 +0000 (15:47 -0800)]
Fix the radiotap printer to handle the special bits correctly.
Process bits 29, 30, and 31 in code that's independent of what namespace
we're in:
If we're switching to the radiotap namespace, reset the bit numbers to
start back at 0.
If we're switching to a vendor namespace, get the vendor OUI and
subspace, and the skip length.
Keep trace of which namespace we're in.
If we're *in* a vendor namespace, skip over the data specified by the
skip length (and reset it, as we've processed all the vendor namespace
data and, if there's a subsequent bitmap in the same namespace,
there's nothing more to process. Use cpack_align_and_reserve() to
skip that, so we check that we don't go past the end of the packet
data.
Fixes GitHub tcpdump issue #498.
This removes some bogus errors; update the test output to reflect that.
Guy Harris [Thu, 31 Dec 2015 02:49:37 +0000 (18:49 -0800)]
Use the new debugging routines in libpcap.
Newer versions of libpcap, when configured to provide debugging
printouts for the filter expression parser or optimizer, provide
routines to set the "debug the parser" and "debug the optimizer" flags;
use them if the library has them. If the library doesn't have them, do
our best to try to use the older mechanisms for requesting debugging, if
present.
Denis Ovsienko [Mon, 28 Dec 2015 10:32:57 +0000 (10:32 +0000)]
RSVP: squelch a compiler warning
./print-rsvp.c: In function ‘rsvp_print’:
./print-rsvp.c:1870:13: warning: ISO C90 forbids mixed declarations and code [-Wpedantic]
u_short subplen, subtlen;
^
Guy Harris [Mon, 28 Dec 2015 04:13:14 +0000 (20:13 -0800)]
I suspect an INTEGRITY object in a submessage covers only the submessage.
So don't hand rsvp_obj_print() a pointer to the beginning of, and the
length of, the entire bundle message; hand it a pointer to the beginning
of, and the length of, the submessage.
Use "bundle" rather than "aggregate" as the message type, while we're at
it; to quote RFC 2961, "The term "bundling" is used to avoid confusion
with RSVP reservation aggregation."
Guy Harris [Mon, 28 Dec 2015 01:59:56 +0000 (17:59 -0800)]
Have signature_verify() do the copying and clearing.
Just pass it a pointer to a routine to do the clearing and a pointer to
the data that needs to be cleared; signature_verify() will relocate all
pointers to stuff that needs to be cleared to point into the copy, clear
the signature itself, and call the routine to clear anything else.
Guy Harris [Thu, 17 Dec 2015 05:04:13 +0000 (21:04 -0800)]
The last 2 bytes of an Ethernet header are the "length/type field".
Call it that, to indicate that it's not necessarily a type field.
While we're at it, get rid of references to "DEC/Intel/Xerox" and
"802.3" Ethernet headers in comments; since 802.3y, the 802.3 standard
supports both "DIX" frames, with a type field, and earlier 802.3 frames,
with a length field, so there's only one version of Ethernet, 802.3,
which supports frames with type fields and frames with length fields.
Francois-Xavier Le Bail [Wed, 16 Dec 2015 14:48:14 +0000 (15:48 +0100)]
Ethernet: Print the Length/Type field as length when needed
Reference: IEEE Std 802.3-2012
"If the value of this field is less than or equal to 1500 decimal
(05DC hexadecimal), then the Length/Type field indicates the number
of MAC client data octets contained in the subsequent MAC Client Data
field of the basic frame (Length interpretation)."
Guy Harris [Wed, 16 Dec 2015 03:12:00 +0000 (19:12 -0800)]
Do more bounds checking.
Step through the SCTP packet with the bp variable, and keep a packet
data remaining variable and use that for bounds checking. For each
chunk, keep a chunk data remaining variable and use that as well. If
there's not enough room for a full item, that gets reported as an error.
Guy Harris [Tue, 15 Dec 2015 19:22:19 +0000 (11:22 -0800)]
Use uintptr_t to look at the bits of a pointer.
We use AC_TYPE_UINTPTR_T in the configure script, so it'll be defined if
we use autotools, and MSVC has supported it since at least Visual Studio
.NET 2003, so we'll use it instead of "unsigned long"; "unsigned long"
causes warnings on LLP64 platforms, as it's not wide enough for a
pointer on those platforms.
Used for Cisco CoA/Disconnect, as shown on https://supportforums.cisco.com/discussion/11719766/ise-112-change-authorization-avaya-switches-5520. The RFC says port 3799, but Cisco does this otherwise, which means this is not an officially reserved port for RADIUS.
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.