[Mimedefang] [Patch] relay_is_* not ipv6 friendly (IPv4 Compatible "patch")

David F. Skoll dfs at roaringpenguin.com
Wed Feb 3 10:33:10 EST 2010


Hi,

Here's my compromise on the IPv4-mapped IPv6 address question:

	    if (tmp) {
		if (IN6_IS_ADDR_V4MAPPED(&in6sa->sin6_addr) ||
		    IN6_IS_ADDR_V4COMPAT(&in6sa->sin6_addr)) {
		    if (strchr(data->hostip, '.')) {
			char const *lastcolon = strrchr(data->hostip, ':');
			char *dst = data->hostip;
			while(lastcolon) {
			    lastcolon++;
			    *dst++ = *lastcolon;
			    if (!*lastcolon) break;
			}
		    }
		}
	    }

So we only do the evil hack if IN6_IS_ADDR_V4MAPPED or
IN6_IS_ADDR_V4COMPAT returns true.  I think that should be pretty
safe... if we can't trust our system's own inet_ntop function, we're
in trouble anyway.

Comments welcomed.

Regards,

David.



More information about the MIMEDefang mailing list