Denis Ovsienko [Fri, 12 Dec 2014 23:34:20 +0000 (23:34 +0000)]
OpenFlow: improve vendor message decoding
Introduce a new function that tries to dispatch an OFPT_VENDOR message
to a vendor-specific printer function. Add such a function for Big
Switch Networks vendor with about as little decoding as necessary to
cover the existing 7050Q OF1.0 capture.
Denis Ovsienko [Thu, 11 Dec 2014 23:49:30 +0000 (23:49 +0000)]
OpenFlow: add vendor name printing
The new function goes into print-openflow.c as vendor name decoding is
the same in all versions of OpenFlow (although in 1.0 it is "vendor"
and in subsequent versions it is "experimenter"). The mapping is from:
Francois-Xavier Le Bail [Mon, 8 Dec 2014 21:18:16 +0000 (22:18 +0100)]
OLSR: fix "Unchecked return value" found by Coverity
The bounds check is already done before by ND_TCHECK2(*msg_data, addr_size +
name_entry_len + name_entry_padding).
So we are deliberately ignoring the return values of fn_printn with last
argument NULL (no bounds check).
Francois-Xavier Le Bail [Mon, 8 Dec 2014 20:24:59 +0000 (21:24 +0100)]
CDP: 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 values of fn_printn with last
argument NULL (no bounds check).
Francois-Xavier Le Bail [Fri, 14 Nov 2014 19:14:29 +0000 (20:14 +0100)]
TESTonce & others: 'make check' need to do a strict comparison, including spaces
Currently, TESTonce uses 'diff -w' so it ignores all white space.
We need a strict comparison, else there is no difference between, for example,
'Association Setup' and 'AssociationSetup' => removing the option '-w'
Guy Harris [Wed, 12 Nov 2014 03:05:48 +0000 (19:05 -0800)]
Further cleanups.
Use ND_TCHECK() rather than home-brew bounds checks. Do simpler length
checks.
Let i be the length of the actual remaining packet data; use ND_TCHECK()
inside loops that iterate over the remaining data.
Let the printers for particular message types cast the raw data pointer
to a pointer of the appropriate type, rather than passing two pointers,
with different types, to the same data.
Guy Harris [Wed, 12 Nov 2014 01:24:12 +0000 (17:24 -0800)]
Add initial bounds check, get rid of union aodv.
Fetch the type field without using a structure, and check to make sure
it's not past the end of the packet.
Pass to each dissection routine a pointer to the appropriate message
type structure, rather than a pointer to a union of all the message type
structures.
Guy Harris [Mon, 10 Nov 2014 07:24:53 +0000 (23:24 -0800)]
Use ND_TCHECK() to do bounds checking.
While we're at it, just use the record count to when iterating over
records; the ND_TCHECK()s will make sure we don't run past the end of
the captured data.
Also get rid of an unused argument to cnfp_print().
Baruch Siach [Wed, 29 Oct 2014 11:21:05 +0000 (13:21 +0200)]
Use system libpcap when configured with --with-system-pcap
Don't force the local libpcap build when the system provides one. When
--with-system-pcap is given to configure, don't try to locate a local libpcap
build. This help build systems like Buildroot that store build trees in the
same directory, but still prefer dynamically linking against system wide
libpcap.so to save space.
Guy Harris [Mon, 20 Oct 2014 21:44:47 +0000 (14:44 -0700)]
Fix length fields in UDP headers to be what they should be.
The value of the length field in a UDP header includes the length of the
header itself; the values in this capture didn't. The length fields in
the IP headers and the RADIUS headers were correct and consistent with
each other, and the length fields in the UDP headers are now correct and
consistent with both of them.
Pass a pointer to the struct pkt_top to wb_dops, and calculate the
address of the first struct dophdr there. Check each struct dophdr
before printing it. Hopefully this will quiet a Coverity complaint.
Guy Harris [Sun, 19 Oct 2014 20:42:00 +0000 (13:42 -0700)]
Use the length field in the UDP header.
If it's less than the length of the IP payload, use it as the size of
the UDP packet. If it's greater than the length of the IP payload,
and we're not dissecting the payload, report the length as bad.
Guy Harris [Sun, 19 Oct 2014 18:21:44 +0000 (11:21 -0700)]
Add a routine to print "text protocols", and add FTP/HTTP/SMTP/RTSP support.
"Text protocols" are protocols that have the general feel of FTP, with
command lines with a command name and space-separated arguments and
response lines beginning with a 3-digit reply code. They can also
include HTTP-style headers and an entity body.
We add support for the FTP control channel, HTTP, SMTP, and RTSP. We
also change the SIP printer to use it.
Guy Harris [Wed, 1 Oct 2014 22:32:11 +0000 (15:32 -0700)]
Leave it up to ip6_print() to handle non-IPv6-capable systems.
Always define and declare ip6_print(), always compile print-ip6.c, and
always call it if we recognize a payload as IPv6. If INET6 isn't
defined, ip6_print() will just print the length and note that printing
isn't supported.
That way, we don't do weird dissection of IPv6 packets on systems
without IPv6 support, due to, for example, ethertype_print() returning 0
("not dissected") for IPv6 packets on those systems (IPv6-over-Frame
Relay was dissected weirdly due to this).
Guy Harris [Wed, 1 Oct 2014 20:12:13 +0000 (13:12 -0700)]
Add some more parentheses, Just In Case.
I'm not sure whether
Performing a byte swapping operation on "p" implies that it came
from an external source, and is therefore tainted.
from Coverity means that it thinks we're byte-swapping the pointer
*itself*, or that we're byte-swapping what it points to, but, just in
case it's the former, let's try throwing some more parentheses in.
(If it's the latter, well, yes, it's packet data, so it comes from an
external source, but Coverity didn't seem to point out any place where
we were using the data it points to without checking its value in cases
where we have to.)
Guy Harris [Wed, 3 Sep 2014 21:03:53 +0000 (14:03 -0700)]
Clarify what abort_on_misalignment() does.
It doesn't request byte misalignment repair, it requests that byte
misalignment kill the program with SIGBUS; on platforms that don't
support aligned loads, we should be fetching possibly-misaligned data
using some safe instruction sequence, not by doing misaligned loads and
relying on them to trap to the kernel and be (slowly) emulated.
Print square brackets around the tag value in RADIUS strings
Before, VLAN attributes that had a tag 1 looked like this:
Tunnel Medium Attribute (65), length: 6, Value: Tag[1]802
Tunnel Private Group Attribute (81), length: 4, Value: Tag 14
With the Tunnel-Medium-Type attribute (65), it is clear where the tag ends and the value begins. With this patch, the value for a string type (like Tunnel-Private-Group-Id) looks similar:
Tunnel Private Group Attribute (81), length: 4, Value: Tag[1]4
Guy Harris [Sun, 31 Aug 2014 18:57:04 +0000 (11:57 -0700)]
Clean up configure check for libsmi.
First, check for smi.h. If we don't have it, don't check for anything
else.
If we do have it, check for libsmi containing smiInit. If we don't have
it, don't check for anything else.
If we do have it, check, with our test program, whether we can use it.
If that succeeds, prepend -lsmi to LIBS, and set USE_LIBSMI. Otherwise,
don't do either of those.
Check, in source, *only* for USE_LIBSMI. If it's set, use libsmi,
otherwise don't - don't even include smi.h, even if we happened to have
found it, and don't print the libsmi version string.
Guy Harris [Fri, 15 Aug 2014 01:19:00 +0000 (18:19 -0700)]
Qualify "length" when printing it.
In the "the TLV length is too short" message, we're printing the length
of the entire TLV; report it as "TLV length". If we pass that test,
we've subtracted out the lengths of the T and the L, leaving only the
length of the V, so report it as "value length".
Guy Harris [Fri, 15 Aug 2014 00:14:32 +0000 (17:14 -0700)]
Check for TLV length too small.
The TLV length includes the T and the L, so it must be at least 4.
This means we don't need the "avoid infinite loop" check later; that
check was wrong, as per GitHub issue #401 and #402; this fixes #402,
which has a different patch for that bug.