Nmap Development mailing list archives

Re: IPv6 mass_dns and nsock_connect_udp


From: David Fifield <david () bamsoftware com>
Date: Tue, 2 Dec 2008 18:17:41 -0700

On Tue, Dec 02, 2008 at 07:06:35PM -0600, Kris Katterjohn wrote:
I'm making some progress with a little project to allow mass_rdns to do
lookups for IPv6 addresses (async code rather than the system resolver)
and to connect to an IPv6 socket on dns servers - I'm using MS Visual
C++ EE.

I've changed a member of the struct dns_server_s from sockaddr_in to
sockaddr_storage and hit a snag after connect_dns_servers() calls
nsock_connect_udp().

Previously, connect_dns_servers passed a reference to a dns_server_s
sockaddr_in casted to a pointer to a sockaddr along with sizeof(struct
sockaddr) which are defined as saddr and sslen respectively in
nsock_connect_udp.
saddr is then casted to pointer to a sockaddr_storage, but sslen remains
unchanged:


Instead of passing "sizeof(struct sockaddr)" for sslen, you should pass in the
size of the struct you're using.  So pass in "sizeof(struct sockaddr_in)" for
IPv4 or "sizeof(struct sockaddr_in6)" for IPv6.  The current use of sockaddr{}
works because both it and sockaddr_in{} should always be the same size (look
at the sin_zero field of the latter).

Kris, is this the same thing as at

"Ncat: socket bind error on Mac OS X"
http://seclists.org/nmap-dev/2008/q3/0168.html

If so, then that thread might help, jah.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: