tcpdump mailing list archives

Re: print-ahcp.c on MSVC


From: Guy Harris <guy () alum mit edu>
Date: Tue, 11 Mar 2014 13:33:04 -0700


On Mar 11, 2014, at 11:40 AM, Gisle Vanem <gvanem () yahoo no> wrote:

Applying this patch fixes it though:

Checked into the trunk and pushed.

Time for an INET6 aware util.c print-function for these cases?

ip6addr_string() is a macro wrapper for getname6().

getname6() uses both gethostbyaddr() and inet_ntop() with AF_INET6, so it currently requires those two functions to 
exist and requires AF_INET6 to be defined and supported by those functions.

If a platform has inet_ntop() and AF_INET6, and inet_ntop() supports AF_INET6, but it doesn't have gethostbyaddr() or 
it has one that doesn't support AF_INET6, we could have getname6() just use that and skip gethostbyaddr(); I don't know 
if there are any such platforms, however.

Otherwise, we'd have to duplicate inet_ntop() and use that; fortunately, we *have* duplicated it, in 
missing/inet_ntop.c.  Unfortunately, it only supports AF_INET6 if INET6 is defined.  What we could do, I guess, is:

        if AF_INET6 isn't defined for the platform, define it ourselves, with some appropriately-chosen value;

        always build getname6() and always define ip6addr_string();

        have a #define to indicate whether gethostbyaddr() supports IPv6, and use that to control whether to use it in 
getname6();

and then get rid of all the "#ifdef INET6" that only check whether we have ip6addr_string() and getname6().

That might not work as we want on systems that have inet_ntop() and either don't define AF_INET6 or don't support it in 
inet_ntop(), however.  I don't know whether there are any such platforms.
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: