Commit Graph

5285 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
5fe61e70f1 Simplify some expressions
In the equality case, the difference is also zero.
2018-06-01 22:25:17 +02:00
Francois-Xavier Le Bail
b4503d7c31 Add more nd_print_trunc() calls
Update the output of some tests accordingly.

Moreover:
Add a ndo_protocol assignment in pimv2_print().
2018-06-01 16:20:56 +02:00
Francois-Xavier Le Bail
1f37b9f529 DCCP: Fix a truncation message
It's a truncated packet, not sure it's invalid.
2018-05-29 18:26:14 +02:00
Francois-Xavier Le Bail
ba255958e1 Make the NFLOG test case unconditional
There is no more HAVE_PCAP_NFLOG_H macro to test.

libpcap has support for NFLOG in current in 1.8.1 and in old releases
1.7.4, 1.6.2 and 1.5.3.

Thus there should be no problem to always do the test.
2018-05-29 13:56:26 +02:00
Francois-Xavier Le Bail
ee46167b27 Add a nd_print_trunc() call
Update the output of a test accordingly.
2018-05-29 12:03:48 +02:00
Francois-Xavier Le Bail
74d0778d0c ES-IS,IS-IS: Add two missing return
Update the output of some tests accordingly.
2018-05-25 17:12:45 +02:00
Francois-Xavier Le Bail
9e7cd40a7a UDP: Add two missing return 2018-05-25 13:21:43 +02:00
Francois-Xavier Le Bail
2897a032d0 Bluetooth: Add a missing return 2018-05-25 11:42:23 +02:00
Francois-Xavier Le Bail
e78cc7f2b1 We no longer need pcap/nflog.h nor pcap/bluetooth.h, step 2 2018-05-25 10:46:05 +02:00
Francois-Xavier Le Bail
38e32cdf14 Remove trailing spaces/tabs 2018-05-25 09:56:04 +02:00
Guy Harris
11736750e8 Update closing #endif comment. 2018-05-24 14:13:48 -07:00
Guy Harris
66384fa15b We no longer need pcap/nflog.h nor pcap/bluetooth.h. 2018-05-24 14:13:22 -07:00
Guy Harris
cde392ab16 Cast dport and sport to u_int before shifting them.
The result of the expression is ultimately going to be put into a u_int;
cast them to u_int so that we'll be shifting unsigned values left rather
than int values, to avoid undefined behavior.

This should fix GitHub issue #681.
2018-05-24 12:11:09 -07:00
Guy Harris
4ba56b8c2e Encrypted data buffer sizes must also be a multiple of the cipher block size.
This should address the issue in GitHub pull request #680.
2018-05-24 11:45:19 -07:00
Guy Harris
e7011808da Declare the NFLOG pseudo-header ourselves.
It's not specified by a libpcap header that might have a different
layout in different pcap releases, it's specified on the list of
link-layer header types and must remain the same forever (except for
getting additional bits defined), so we don't need to pick it up from
libpcap.

This means we get to use tcpdump's nd_ types; do so.
2018-05-23 14:43:47 -07:00
Guy Harris
e02efb5044 Declare the Bluetooth pseudo-header ourselves.
It's not specified by a libpcap header that might have a different
layout in different pcap releases, it's specified on the list of
link-layer header types and must remain the same forever (except for
getting additional bits defined), so we don't need to pick it up from
libpcap.

This means we get to use tcpdump's nd_ types; do so.
2018-05-23 14:12:45 -07:00
Francois-Xavier Le Bail
e73118bc07 Add more nd_print_trunc() calls
Update the output of some tests accordingly.

Moreover:
Update a ndo_protocol assignment.
2018-05-23 12:07:58 +02:00
Francois-Xavier Le Bail
03467d3e79 Add a nd_print_trunc() call
Moreover:
Rename a function with _print like in most similar cases
2018-05-23 09:55:36 +02:00
Francois-Xavier Le Bail
2b59fefb18 DECnet: Avoid using EXTRACT_ macros on non packet buffer pointers
Remove two now useless variables.
2018-05-22 13:49:07 +02:00
Francois-Xavier Le Bail
6df4852ec3 DCCP: Fix printing "Timestamp" and "Timestamp Echo" options
Add some comments.

Moreover:
Put a function definition name at the beginning of the line.
2018-05-22 11:31:46 +02:00
Francois-Xavier Le Bail
519a3f6636 Rx: Use the fn_print_str() function instead of nd_print()
We cannot use nd_print() because the parameter is not a pointer on the
packet buffer.
2018-05-20 18:49:26 +02:00
Francois-Xavier Le Bail
d5b451c089 Add more nd_print_trunc() calls
Update the output of a test accordingly.

Moreover:
Avoid printing useless '\n'.
2018-05-20 11:49:37 +02:00
Francois-Xavier Le Bail
4938de657c NTP: Fix extracting the poll value
Use EXTRACT_S_1 for ppoll (signed).
2018-05-20 08:13:27 +02:00
Francois-Xavier Le Bail
366dafcf78 DECnet: Pointers to packet bytes should be u_char *, not char * 2018-05-19 21:00:02 +02:00
Francois-Xavier Le Bail
3efcefafd8 Add a cast to the EXTRACT_U_1() macro
This change may avoid sign bit extension problem.
2018-05-19 20:43:35 +02:00
Francois-Xavier Le Bail
226c6a8d0f Replace some double parentheses with single parentheses 2018-05-19 20:33:37 +02:00
Guy Harris
87a92d9f28 Pointers to packet bytes should be u_char *, not char *. 2018-05-19 11:13:00 -07:00
Francois-Xavier Le Bail
6f2cd8cee6 timed: Fix bounds check when printing Machine Name 2018-05-19 12:36:55 +02:00
Francois-Xavier Le Bail
419cc7087b IEEE 802.11: Print the SSID with the fn_print_str() function
We cannot use nd_print() because the parameter is not a pointer on the
packet buffer.
2018-05-19 09:14:19 +02:00
Francois-Xavier Le Bail
7187e01f8f Add the fn_print_str() function
This function print a null-terminated string, filtering out non-printable
characters.
DON'T USE IT with a pointer on the packet buffer because there is no
truncation check. For this use, see the nd_printX() functions.
2018-05-18 23:05:01 +02:00
Francois-Xavier Le Bail
6e1fdd00a6 Add a nd_print_trunc() call
Replace a ND_TTEST_*() with ND_TCHECK_*().
Update the output of some tests accordingly.
2018-05-18 14:58:38 +02:00
Francois-Xavier Le Bail
34017c6fcb Add a nd_print_trunc() call
Moreover:
Replace a ND_TTEST_*() with ND_TCHECK_*().
2018-05-18 14:01:47 +02:00
Francois-Xavier Le Bail
bdad75a862 Replace some ND_TTEST_*() with ND_TCHECK_*() 2018-05-18 13:16:16 +02:00
Francois-Xavier Le Bail
480af1cdce Add more nd_print_trunc() calls
Update the output of some tests accordingly.
2018-05-18 11:39:52 +02:00
Francois-Xavier Le Bail
a1042c21e5 Use more the nd_print_trunc() call
Update the output of a test accordingly.
2018-05-18 11:16:21 +02:00
Francois-Xavier Le Bail
95e10b2026 TCP: Fix a closing string
It was ">", it must be "]"

Update the output of some tests accordingly.
2018-05-18 10:04:51 +02:00
Francois-Xavier Le Bail
45ecddd334 Fix space printing with istr[]
Because istr[] is assign to " (invalid)", avoid adding a space before it.

Moreover:
Avoid also useless '\n'
2018-05-18 10:03:59 +02:00
Francois-Xavier Le Bail
6cb22c2699 PGM: Remove unused variable and code 2018-05-18 10:03:53 +02:00
Francois-Xavier Le Bail
e056e93cd5 Add more nd_print_trunc() calls
Update the output of some tests accordingly.
2018-05-18 08:34:28 +02:00
Francois-Xavier Le Bail
b7b5b7ddd6 TCP: Add a missing 'truncated' message 2018-05-18 08:20:04 +02:00
Francois-Xavier Le Bail
9234c86b44 Add more nd_print_trunc() calls
Update the output of a test accordingly.
2018-05-18 07:17:45 +02:00
Herwin Weststrate
1433720f40 Fix truncation checks in CONTRIBUTING 2018-05-17 22:23:24 +01:00
Francois-Xavier Le Bail
15ad390859 Add a nd_print_trunc() call
Update the output of some tests accordingly.
2018-05-17 13:59:05 +02:00
Francois-Xavier Le Bail
d07444a5f2 Add more nd_print_trunc() calls
Update the output of some tests accordingly.
2018-05-17 12:51:47 +02:00
Guy Harris
db3f9f277f Make the hex-dumping routines for addresses take a uint8_t * argument.
Hopefully, that will convince Coverity that the result of dereferencing
those pointers will have a value between 0x00 and 0xff, and therefore
that shifting that result right by 4 bits will yield a value between 0x0
and 0xf, and therefore that this result can safely be used as an index
into the 16-element hex[] array.

I guess Coverity wants us to realize that there really *are* C
implementations out there with non-8-bit char and unsigned char values,
even though getting tcpdump to work on them will probably be a highly
entertaining exercise (not to mention that the only one I know of that's
actually being *used* are the Unisys Clearpath Dorado series, and
they're one's complement, which is yet *another* place where the port
could be entertaining...).
2018-05-14 01:52:54 -07:00
Francois-Xavier Le Bail
6daf3a543e Add a nd_print_trunc() call
Update the output of a test accordingly.

Moreover:
Add a ndo_protocol reassignment after xxx_print() calls.
2018-05-10 21:17:35 +02:00
Francois-Xavier Le Bail
d880293429 Add a nd_print_trunc() call
Update the output of some tests accordingly.

Moreover:
Add a ndo_protocol reassignment after ip_print() call.
2018-05-10 20:47:44 +02:00
Francois-Xavier Le Bail
40ae3ad744 Add more nd_print_trunc() calls
Update the output of some tests accordingly.

Moreover:
Add a ndo_protocol field assignment.
2018-05-10 18:05:56 +02:00
Francois-Xavier Le Bail
1889ef324c Remove some spaces (style) 2018-05-10 17:40:20 +02:00
Francois-Xavier Le Bail
53d1f7a25a Update hex_and_ascii_print_with_offset() to static 2018-05-10 16:48:48 +02:00