Ethereal-dev: [ethereal-dev] Help needed understanding inet_pton.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Wed, 5 Jan 2000 17:13:25 -0600
Help!

As you know, I'm working on build problems, aka "win32".

Looking at inet_pton.c, I see that it's careful about referencing
inet_pton4() only if AF_INET is defined and inet_pton6() only if AF_INET6
is defined. AF_INET6 is *always* defined, via inet_v6defs.h).


But on line 208, inside the inet_pton6() function, a usage of inet_pton4 is
not guarded by an #ifdef block:


		if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
		    inet_pton4(curtok, tp) > 0) {
			tp += NS_INADDRSZ;
			saw_xdigit = 0;
			break;	/* '\0' was seen by inet_pton4(). */
		}
		return (0);

I ran into this problem because I had not included winsock.h (or should
I be including winsock2.h ?), which defines AF_INET.

Yes, I know the problem will go away as soon as I #include winsock.h, but the code
as it stands is not right, so _that_ bugs me.

Since inet_pton.c is being compiled in the case that inet_pton() does not exist
on the system, is it okay for me to remove all #ifdef checks for AF_INET and AF_INET6
in this file?

Or, should I try to fix this inet_pton6() function to not call inet_pton4() is not
#defined ?

--gilbert