Replace more calls to ipaddr_string()/ip6addr_string() with calls to
GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds
checking.
Add similar bounds-checking inline functions and macros to wrap
linkaddr_string(), etheraddr_string(), and isonsap_string() and convert
calls to them to use the macros as well.
Shuffle the inline functions in addrtoname.h around a bit, so that the
inline functions, external declarations, and macros are all in the same
order.
We require an environment with a C99-compatible snprintf(), so we don't
need to work around older implementations. Make the configuration
process fail if we don't have snprintf() and vsnprintf().
We require at least VS 2015, so we don't have to check for _MSC_VER >=
1400. Make the build fail if we don't have at least VS 2015.
We apparently do, however, have to use __inline, as the VS 2015
documentation doesn't meaning plain old "inline". Update a comment.
The exceptions are currently:
Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer.
An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer
pointer.
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.
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).
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.
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.