Francois-Xavier Le Bail
180fae3dc2
Use more the nd_print_trunc() call
...
Update the output of some tests accordingly.
2018-08-20 16:37:08 +02:00
Francois-Xavier Le Bail
ef85f48a7e
ICMPv6: Fix printing 'Reachable Time' and 'Retrans Timer' as milliseconds
...
Update 'retrans time' to 'retrans timer'.
See: https://tools.ietf.org/html/rfc4861#section-4.2 .
Update the output of some tests accordingly.
2018-07-09 20:28:19 +02:00
Francois-Xavier Le Bail
01ced9f115
ICMPv6: Add a length check
...
If the length is zero, it's invalid, print that.
Add a test with this case.
2018-06-23 19:59:07 +02:00
Francois-Xavier Le Bail
f28f87d6ee
ICMPv6: Avoid reinventing ND_TCHECK_*() macros
2018-06-03 17:38:52 +02:00
Francois-Xavier Le Bail
1889ef324c
Remove some spaces (style)
2018-05-10 17:40:20 +02:00
Francois-Xavier Le Bail
0cced4fcdc
Remove the safeputchar() function
...
Print the characters filtering out non-printable with fn_print_char().
Update the output of some tests accordingly.
2018-05-02 03:33:02 +02:00
Francois-Xavier Le Bail
56e6581c34
Remove useless comments
2018-03-19 15:16:32 +01:00
Francois-Xavier Le Bail
546558eabd
Add the ndo_protocol field in the netdissect_options structure
...
Update this field in printer entry functions.
It will be used for some printings.
2018-03-16 19:44:47 +01:00
Francois-Xavier Le Bail
e048961ec1
ICMPv6: Squelch a GCC warning
...
The warning was:
./print-icmp6.c: In function 'icmp6_print':
./print-icmp6.c:1284:10: warning: cast discards '__attribute__((const))'
qualifier from pointer target type [-Wcast-qual]
in6 = (const nd_ipv6 *)(dp + 1);
^
2018-02-14 11:51:09 +01:00
Guy Harris
a7ca1167ed
Undo the previous change; it didn't help.
...
Either we're missing something or GCC is.
2018-02-13 20:53:40 -08:00
Guy Harris
98440166f7
Try to squelch a GCC warning.
...
Maybe I've gotten lost in a twisty little maze of typedefs and array
pointers, all different, but I don't see how casting a const struct
icmp6_hdr * to a const nd_ipv6 * discards constness, and clang on my Mac
agrees with me.
First cast to const u_char * and then to const nd_ipv6 *, in the hopes
that GCC won't complain.
2018-02-13 20:49:07 -08:00
Guy Harris
c2a9094394
Merge branch 'master' of github.com:the-tcpdump-group/tcpdump
2018-01-31 00:47:26 -08:00
Guy Harris
0dad1934af
Have ip{6}addr_string take a u_char * as the second argument.
...
Fix warnings that introduces.
2018-01-31 00:43:45 -08:00
Francois-Xavier Le Bail
150fa329b5
Remove unneeded '&' when getting a pointer to a nd_ipv6 type
2018-01-31 08:33:31 +01:00
Guy Harris
44c822e9f6
More nd_ipv6-ification.
2018-01-30 21:06:06 -08:00
Guy Harris
3db38df8ed
Use nd_ipv6 rather than struct in6_addr in packet-layout structures.
...
Also, use it, and nd_ipv4, in sizeof() operations.
2018-01-30 17:29:33 -08:00
Guy Harris
c499612a7f
Add nd_{v}snprintf() routines/wrappers.
...
Some versions of the MSVC runtime library have a non-C99-compliant
vsnprintf(), which we want to avoid. On Windows, use snprintf() and
vsnprintf() for VS 2015 and later, where they both exist in
C99-compliant forms, and wrap _{v}snprintf_s() otherwise (they're
guaranteed to do the null termination that we want).
2018-01-29 15:48:55 -08:00
Francois-Xavier Le Bail
380fd7a4b0
ICMPv6: Use more ND_TCHECK_n() macros
...
Moreover:
Remove unneeded '&' when getting a pointer to an nd_uintN_t type
2018-01-24 18:24:57 +01:00
Francois-Xavier Le Bail
95d9d4925a
ICMPv6: Make some code clearer
2018-01-24 14:16:03 +01:00
Francois-Xavier Le Bail
6e15ad4b99
Use more ND_TCHECK_n() macros
2018-01-22 21:51:29 +01:00
Guy Harris
fb2479d733
Always include <config.h> rather than "config.h".
...
This can prevent bizarre failures if, for example, you've done a
configuration in the top-level source directory, leaving behind one
config.h file, and then do an out-of-tree build in another directory,
with different configuration options. This way, we always pick up the
same config.h, in the build directory.
2018-01-21 12:27:28 -08:00
Francois-Xavier Le Bail
bc44bb9b7d
ICMPv6: Use more ND_TTEST_n() macros
2018-01-21 19:22:34 +01:00
Francois-Xavier Le Bail
513f782ae1
Use quoted include netdissect-stdinc.h instead of angle-bracketed one
2018-01-21 10:28:15 +01:00
Guy Harris
64677b0d78
Clean up signed vs. unsigned.
2018-01-11 11:52:30 -08:00
Francois-Xavier Le Bail
e2982e7f6f
Update ND_PRINT() as a variadic macro
2018-01-07 13:36:41 +01:00
Francois-Xavier Le Bail
ff1c209392
Fix some Coccinelle warnings "a \ character appears outside of a #define"
2018-01-04 13:26:39 +01:00
Francois-Xavier Le Bail
d526e47658
Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)
2018-01-03 21:32:07 +01:00
Guy Harris
58f2aa4b57
Use nd_ types, clean up ICMPv6 dissection.
...
Use nd_ types for various packet structures, and use EXTRACT_ macros as
necessary. Get rid of & in EXTRACT_ macros if not necessary.
The 1-byte pad RPL suboption is called PAD1, not PAD0, in the RFC.
Rename rpl_dio_printopt() to rpl_printopts() because 1) it's for all RPL
messages and 2) it prints multiple options. Clean up its processing
loop.
Pass rpl_print() the ICMPv6 code, not a pointer to the full header; all
it needs is the code.
Use %u to print unsigned values.
In Node Information node address lists, the TTL comes before the
address, as per the RFC. Dissect it that way.
2017-12-18 21:41:18 -08:00
Guy Harris
09393e2faa
Pull rpl.h into print-icmp6.c; nothing else uses it.
2017-12-14 20:30:09 -08:00
Francois-Xavier Le Bail
81e4dfecd3
ICMPv6: Replace ND_TCHECK2 calls by ND_TCHECK_LEN calls
2017-12-14 22:21:52 +01:00
Guy Harris
6fe4295795
Use nd_ types for AH headers.
2017-12-13 20:43:33 -08:00
Francois-Xavier Le Bail
5cea270318
Remove all storage class specifier 'register'
...
Let the compiler do the optimizations (or not) based on build options.
Avoid 'value has been optimized out' messages in gdb using '-O0'.
2017-12-13 19:17:47 +01:00
Guy Harris
a95802aa0d
Use nd_ types in the IPv6 structures.
...
And add the EXTRACT_U_1() calls as needed.
Change some other EXTRACT_ calls that no longer need an & operator.
2017-12-11 19:38:35 -08:00
Francois-Xavier Le Bail
84ef17ac0e
Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)
...
ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l)
ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
2017-12-11 22:11:01 +01:00
Guy Harris
3f3f2505f2
Make nd_uint8_t and nd_int8_t arrays, to catch direct references.
...
This catches direct references, so we can change them to use EXTRACT_U_1
or EXTRACT_S_1.
Also, change some structures to use the nd_ types that weren't already
using them.
Then make the appropriate EXTRACT_{U,S}_1() changes.
2017-12-10 16:23:34 -08:00
Francois-Xavier Le Bail
6bb65331a5
Use more the EXTRACT_U_1() macro (53/n)
...
Assignment, p[n], (more)
2017-12-10 11:40:35 +01:00
Francois-Xavier Le Bail
07ac438e08
Use more the EXTRACT_U_1() macro (52/n)
...
Assignment, p[n]
2017-12-09 14:05:25 +01:00
Francois-Xavier Le Bail
1cfd6cd2ac
Use more the EXTRACT_U_1() macro (51/n)
...
Moreover: Use more the ND_ISPRINT() macro.
2017-12-09 11:46:15 +01:00
Francois-Xavier Le Bail
00b189d27c
Use more the ND_TCHECK_1() macro
2017-12-04 17:50:29 +01:00
Francois-Xavier Le Bail
4166458a2a
Use more the EXTRACT_U_1() macro (46/n)
...
In: if (... p[n] ...) ...
2017-12-03 21:51:36 +01:00
Francois-Xavier Le Bail
61c422a88c
Use more the EXTRACT_U_1() macro (43/n)
...
In: if (... p[n] ...) ...
2017-12-03 13:35:26 +01:00
Francois-Xavier Le Bail
97de8ca7bd
Use more the EXTRACT_U_1() macro (35/n)
...
In some safeputchar() calls, *(p).
2017-11-30 23:08:07 +01:00
Francois-Xavier Le Bail
415160c0c2
Use more ND_TCHECK_n() macros
2017-11-29 21:06:51 +01:00
Francois-Xavier Le Bail
dde3aa9975
Use more the EXTRACT_U_1() macro (32/n)
...
In: while (... *(p) ...) ...,
while (... *(p + e) ...) ...
2017-11-28 22:22:35 +01:00
Francois-Xavier Le Bail
1a90fd99d2
Use more the EXTRACT_U_1() macro (28/n)
...
In ND_PRINT() macro call(s) (step 7).
p[n] ...
2017-11-26 15:44:43 +01:00
Francois-Xavier Le Bail
575188b5bf
Use pointer expressions like in most similar cases
2017-11-25 18:21:18 +01:00
Francois-Xavier Le Bail
39c8c55aa9
Use more ND_TCHECK_n()/ND_TTEST_n() macros
2017-11-24 22:48:55 +01:00
Francois-Xavier Le Bail
8d3c7406c4
Use more the EXTRACT_U_1() macro to fetch a one-byte value (23/n)
...
Reminder: EXTRACT_8BITS is now EXTRACT_U_1.
In tok2str() calls (step 4).
2017-11-23 15:05:08 +01:00
Francois-Xavier Le Bail
da20bc56d6
Rename EXTRACT_ macros
...
Now all the macros have a name meaning a count in bytes.
With _S_: signed, _U_: unsigned
e.g.:
EXTRACT_BE_32BITS -> EXTRACT_BE_U_4
EXTRACT_LE_32BITS -> EXTRACT_LE_U_4
...
EXTRACT_BE_INT32 -> EXTRACT_BE_S_4
and have:
EXTRACT_8BITS -> EXTRACT_U_1
EXTRACT_INT8 -> EXTRACT_S_1
2017-11-22 23:54:09 +01:00
Francois-Xavier Le Bail
01cd3621f1
Use more the EXTRACT_8BITS() macro to fetch a one-byte value (22/n)
...
In ND_PRINT() macro calls, *p++.
Partial list.
2017-11-22 16:02:02 +01:00