Commit Graph

5443 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
ebf60e3cce Add a nd_print_trunc() call 2018-09-24 21:42:08 +02:00
Francois-Xavier Le Bail
0446070756 ICMPv6: Fix some truncation codes 2018-09-24 07:44:46 +02:00
Francois-Xavier Le Bail
62b2632f35 IP6OPTS: Fix some truncation codes
Moreover:
Update the output of some tests accordingly.
Fix style.
2018-09-24 07:44:46 +02:00
Guy Harris
58d3d6c9f6 Update a test file.
The bug fix in ccd4a6b3b9 means we
correctly set the packet length to be the PDU length, so we can check
the checksum.
2018-09-23 19:15:10 -07:00
Guy Harris
1dbc62cb83 Clean up some narrowing warnings.
Cast pointer differences, widen some variables, make some function
returns unsigned as they never return a negative number.

Fix a format while we're at it.
2018-09-23 18:09:56 -07:00
Guy Harris
ccd4a6b3b9 Fix the variable for the packet length.
The length passed in is a u_int, so we should assign it to a u_int, not
a u_short.
2018-09-23 18:02:37 -07:00
Francois-Xavier Le Bail
bbe15da782 SLIP: Add some bounds checks
This should fix GitHub issues #676 and #677.
2018-09-22 16:25:59 +02:00
Francois-Xavier Le Bail
dcea6d0284 Update a comment 2018-09-22 15:19:44 +02:00
Francois-Xavier Le Bail
d80d56eec3 IP: Simplify an expression 2018-09-22 12:46:36 +02:00
Guy Harris
e45d9a02dc
Merge pull request #701 from loganaden/master
Update my email address
2018-09-21 20:29:09 -07:00
Loganaden Velvindron
877d7e07fd Update my email address 2018-09-22 07:23:04 +04:00
Guy Harris
3eec801c5a Reorganize the dissection code a bit.
Get rid of the global nfserr variable and, instead, have it be local to
interp_reply().  That means one less global variable, which may be good
if any multi-threaded program tries to use libnetdissect in more than
one thread (there are still global variables that would have to be
removed), and gets rid of some cases where we didn't need to set it.

Don't bundle multiple operations inside an if clause.  This squelches
some warnings from MSVC, and makes the code a bit more uniform and a bit
easier to understand (and, in the process of doing that, found a bug
that was fixed in 596aca3d93).
2018-09-18 00:07:24 -07:00
Guy Harris
596aca3d93 Fix dissection of NFSv3 WRITE and LINK replies.
Don't report them all as truncated if -v isn't specified.
2018-09-16 08:33:38 -07:00
Guy Harris
000261d112 That wasn't correct. 2018-09-16 00:12:57 -07:00
Guy Harris
8896cbdc54 Clean up the name resolution a bit.
If we're not doing name-to-address resolution, don't bother with the
address-to-name table.
2018-09-15 19:14:24 -07:00
Guy Harris
9008c09c88 Don't warn about declarations after statements.
We now allow them, and require a compiler that supports them, so there's
no need to warn about them.
2018-09-15 13:16:02 -07:00
Guy Harris
b6e38e7c52 Don't warn about declarations after statements.
We now allow them, and require a compiler that supports them, so there's
no need to warn about them.
2018-09-15 13:12:49 -07:00
Francois-Xavier Le Bail
0e8826d5fb Add more nd_print_trunc() calls 2018-09-15 17:48:07 +02:00
Guy Harris
4c1c6e8293 Fix data types.
If you're accumulating the lengths of strings, as returned by strlen(),
and passing the result to malloc(), it should be accumulated in a
size_t.
2018-09-15 01:41:59 -07:00
Guy Harris
89576203dd Move getopt_long.h to missing.
That's what we did for win_ether_ntohost.h.
2018-09-14 19:21:06 -07:00
Guy Harris
ec11595998 Revert "Clean up the code a bit."
This reverts commit a5eca2cbbf.

MSVC doesn't complain about it, so leave it alone.
2018-09-14 18:05:55 -07:00
Guy Harris
a5eca2cbbf Clean up the code a bit.
This eliminates a warning from MSVC, and makes the flow a little
clearer.

(Yes, it duplicates some code, but compilers have been pretty good at
merging common code sequences, so it might just turn it into the
equivalent of

	if (optopt == (int)':')
		goto label;
	oli = strchr(ostr, optopt);
	if (!oli) {
	label:
		/*
		 * Unknown option character.
		 */
		if (!*place)
			++optind;

		...
	}

although it does mean that the same C code exists in two places.)
2018-09-14 17:48:45 -07:00
Francois-Xavier Le Bail
3ad93074c1 BGP: Fix an error string
"[|" is the prefix for a truncated string. This is not the case here.
2018-09-14 21:48:35 +02:00
Francois-Xavier Le Bail
3976533f2c Remove some useless tests
Because packet length (length) >= capture length (caplen).

(see the sanity checks in print.c, pretty_print_packet() function)
2018-09-14 18:04:38 +02:00
Guy Harris
6795da23af See if a newer MSVC will produce fewer warnings.
Some of the narrowing warnings are false positives; newer versions of
Clang do a better job than older ones of determining the range of values
of expressions, and don't warn if the range is such that it can be
safely narrowed, so maybe the same is true of MSVC.
2018-09-13 19:19:38 -07:00
Guy Harris
7c36677950 Do parallel builds, run as a developer.
Tell msbuild to build in parallel.  Use Windows syntax for command-line
flags.  Create the .devel file.
2018-09-13 17:14:23 -07:00
Guy Harris
e5c7dcdc04 Try to find the 64-bit libraries in a 64-bit build. 2018-09-13 16:26:39 -07:00
Guy Harris
5d5a9021b5 Do both 32-bit and 64-bit builds. 2018-09-13 16:09:51 -07:00
Francois-Xavier Le Bail
4f1cc2f3e3 Add a nd_print_trunc() call 2018-09-13 21:42:20 +02:00
Francois-Xavier Le Bail
e67f4fcae8 Add more nd_print_trunc() calls 2018-09-13 21:16:44 +02:00
Francois-Xavier Le Bail
818169971c Add more nd_print_trunc() calls 2018-09-13 21:05:16 +02:00
Francois-Xavier Le Bail
c6a5cc1bb4 SLL: Remove two useless tests
Because packet length (length) >= capture length (caplen).

(see the sanity checks in print.c, pretty_print_packet() function)
2018-09-13 19:24:27 +02:00
Francois-Xavier Le Bail
8d316a9ae0 Fix style 2018-09-13 14:52:42 +02:00
Francois-Xavier Le Bail
8aa4617181 Ethernet: Remove two useless tests
Because packet length (len) >= capture length (caplen).

(see the sanity checks in print.c, pretty_print_packet() function)
2018-09-13 14:24:23 +02:00
Francois-Xavier Le Bail
b7fff70582 Ethernet: Remove two useless tests
Because packet length (length) >= capture length (caplen), when
caplen >= ETHER_HDRLEN, length >= caplen cannot be < ETHER_HDRLEN.

Same for the other test (length < 4).

(see the sanity checks in print.c, pretty_print_packet() function)

Moreover:
Clean up indentation.
2018-09-12 19:52:08 +02:00
Francois-Xavier Le Bail
77a49fcb6e Add the nd_print_invalid() function
It prints " (invalid)", used for malformed or corrupted packets.

Moreover:
Update CONTRIBUTING.
2018-09-11 13:09:05 +02:00
Francois-Xavier Le Bail
e2293be847 Make the invalid snaplen message clearer 2018-09-10 16:26:57 +02:00
Francois-Xavier Le Bail
d5ca317dbd More status exit codes for a program using libnetdissect
It can now use status exit codes 0 to 10.
2018-09-09 14:29:06 +02:00
Francois-Xavier Le Bail
0906b438b6 Update a comment with the new macros names 2018-09-09 13:57:25 +02:00
Francois-Xavier Le Bail
6a9b0468b6 Add the debug macro ND_DEBUG 2018-09-06 11:01:56 +02:00
Guy Harris
e0a88590e7 Don't assume ARM supports unaligned accesses.
Prior to ARMv6, it didn't support it.  ARMv6 supports it, if the "don't
act like ARMv5" bit isn't set in the system control register, but has
another bit in the system control register to cause unaligned accesses
to fault rather than succeed.  ARMv7 and later don't have "act like
ARMv5" mode, but still has the "fault on unaligned access" bit.

At least some OSes might set the "fault on unaligned access" bit; if
your OS *doesn't* set it, feel free to modify the #if to check for your
OS and for ARM.
2018-09-05 20:26:39 -07:00
Guy Harris
75953aee36 Clean up white space. 2018-09-05 12:51:24 -07:00
Guy Harris
37e60848a8 Fix test output files to match Juniper dissector changes. 2018-09-05 12:40:35 -07:00
Guy Harris
86c678c6cb Clean up indentation. 2018-09-05 12:05:35 -07:00
Guy Harris
6cc57670fe Remove trailing "_if" from protocol names.
"_if", in function names, is just a convention used for the top-level
routine for a given DLT_ value; it's not part of the protocol name for
the link-layer type.
2018-09-05 12:04:03 -07:00
Viral Mehta
8b9f7d9d76 add test for nfs write verf cookie
test results:
[vmehta@centos72_base tcpdump]# make check | grep nfs
    unaligned-nfs-1                    : passed
    nfs-attr-oobr                      : passed
    hoobr_nfs_printfh                  : passed
    hoobr_nfs_xid_map_enter            : passed
    nfs-seg-fault-1                    : passed
    nfs-write-verf-cookie              : passed <- new test
2018-09-05 10:55:08 +01:00
Viral Mehta
955e4a763b print verifier cookie for write and commit operation 2018-09-05 10:55:08 +01:00
Guy Harris
e12bc85871 Fix the fix. 2018-09-04 14:19:20 -07:00
Guy Harris
1060146448 Fix the no-SSL-library version of that test. 2018-09-04 14:10:24 -07:00
Guy Harris
2f85b72156 Fix tests for BGP changes. 2018-09-04 11:34:41 -07:00