]> The Tcpdump Group git mirrors - tcpdump/commit
Clean up dissection.
authorGuy Harris <[email protected]>
Mon, 9 Jul 2018 16:42:17 +0000 (09:42 -0700)
committerGuy Harris <[email protected]>
Mon, 9 Jul 2018 16:42:33 +0000 (09:42 -0700)
commit154b32ede55d03fb0e3c19ad45349bdb793b9e9f
treee72dd8d2869e32669decdc605f2951d53e153661
parent57cb8fa2c85cec4b7ac80577bc093c0003e11e3b
Clean up dissection.

Don't use pointers to anything other than octets; there is no guarantee
that the L2TP packet is aligned on a 2-byte or 4-byte boundary, and
there is no need to pretend that we have pointers to aligned values -
we're using the EXTRACT_ macros, which will fetch multi-byte integral
values regardless of the alignment of the pointer.

This also fixes some cases where we were advancing 2 bytes after
processing a 1-byte field - we were incrementing a uint16_t * by 1,
which means advancing it by 2 bytes, and we're now incrementing the
uint8_t * by 1.

Don't cast a 4-byte integer to u_long - EXTRACT_BE_U_4() is guaranteed
to return something printable with %u.

Don't fetch fields dividded into "high" and "low" portions 2 bytes at a
time and reassemble them; the only reason they're divided into "high"
and "low" partitions in the ASCII-art diagrams in RFC 2661 is that those
diagrams tend to show packets in the form of 32-bit words, and those
fields aren't aligned on 32-bit word boundaries, so we can just fetch
those fields with EXTRACT_BE_U_4().

Don't print a sequence of AVPs by recursion; iterate instead.

Add some RFC numbers while we're at it.
print-l2tp.c