fun with sockaddr...

Brad Hards bhards at bigpond.net.au
Sat Sep 14 14:50:02 EST 2002


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

I'm a bit confused about the protocol indpendent socket stuff under Linux.

I'm trying to port some code from BSD (a multicast DNS responder, from the 
KAME project) to Linux, but it isn't going too well. I got some of it 
(ifaddrs.h+ifaddrs.c) from the USAGI project, but I think I have some 
fundamental missing stuff.

For example:
	h1[0] = h2[0] = '\0';
	if (getnameinfo((struct sockaddr *)&ss[0],
	    ((struct sockaddr *)&ss[0])->sa_len, h1, sizeof(h1),
	    p, sizeof(p), niflag) != 0)
		return 0;

As far as I can tell, sockaddr doesn't have a sa_len element (and the compiler 
agrees). The man page for getnameinfo() doesn't help me much - it also uses 
the sa_len approach.

Can anyone provide any hints on how to fix this. Or better yet, any tutorial 
material on doing ports of BSD code to Linux  (I have 
http://www.usenix.org/event/usenix2000/freenix/metzprotocol/metzprotocol_html/index.html)

Brad

- -- 
http://conf.linux.org.au. 22-25Jan2003. Perth, Australia. Birds in Black.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9gr/6W6pHgIdAuOMRAjeYAKCNuieoNVW2rbNTSHuUJq9eMkC9UgCgi7rr
LsbTqubUEl2dx55fCqypRJA=
=5dZN
-----END PGP SIGNATURE-----




More information about the linux mailing list