]> 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]>
Wed, 21 Nov 2018 22:16:59 +0000 (14:16 -0800)
commit5a5ac77f358deb7239a51d22fd01e4cea1818077
tree097019ffec606c3bc13a21997b8899b8f829c8cb
parent5e194f9fc63ebeabae4e353141ba9a671683eeab
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.

(cherry picked from commit 154b32ede55d03fb0e3c19ad45349bdb793b9e9f)
print-l2tp.c