Nmap Development mailing list archives

Re: IPv6 mass_dns and nsock_connect_udp


From: Kris Katterjohn <katterjohn () gmail com>
Date: Tue, 02 Dec 2008 19:06:35 -0600

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/02/2008 06:28 PM, jah wrote:
Hi folks,


Hey jah,

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).

Regards,
jah


Thanks,
Kris Katterjohn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJNduUAAoJEP9K37xXYl368QwQALvTQsprvAKUhDUQ5G7iSLbc
aSHuwZxS7z657OBxeurvF48Rhu1DviiO3Mz+oCwLSz2o/FdJIYP/wStMdVThkv7R
xnxmj9ZyPsaxEtOmKICcQoSYBvEDDcrQzGmGO2HGpnl1W9NrbKpcc62urp3AsQQX
yI0ozKLuSB3O0deZWq7cFuNaSEeoAFC8WOKWgDw7H6kRjE8/F7rsmykVtEFcmyvk
rJIwPz7e9Ve8JIUlksh7wiSoYgrru1rH/EHCNrmqXjWeNtegVXxMkTNWi6/pik84
7vQV1IzLbzL04YrPlwYdU3gNptMx0easEySoKkAXQc/6n6d2J/2SRT1QgTfTf60Q
E11RmIoOYm1CeCCUqOBSFJk3inJxHNAYqGmy6hSKYLBIvUp+tqudk2WMRbVAmJe+
bFBI+AAyMGWWuyFLqahCzZ7+mhmYD8TZg+gi8wpu8Z1zFmmFjEmGIo2oV7OkBx14
hGsfioy+YjHpdG9kKvK1phqbwajQVlCWM/tXWzONfJFbzjrZb0OCWJ544RN+WKtz
vEPepE7RYTdFwMIGClwmLcdF9mOvbD13sWxTnV/qpWT434LArM9uFAcsbGDrcKb1
pRJTHeAIgdGOxeUuTep1p+edDCY08D1KHwy4wKE2LRNJPLXEuh+emL9vzvKtqmuz
M97Jwijfp3SKIwxvgpZ+
=C7br
-----END PGP SIGNATURE-----

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


Current thread: