[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: programming question: how to get the addr of a sockaddr_storage?



On/Dnia Wed, Jan 31, 2001 at 07:31:42PM -0300, horape@tinuviel.compendium.net.ar wrote/napisał(a)
> [Is somewhere an ipv6 programming mailing list?]
probably not

> getpeername(fd,&ss,&len);
> getnameinfo((struct sockaddr*) &ss, sizeof(ss),
> 		(char*) sock_ip, sizeof(sock_ip),
> 		NULL, 0, NI_NUMERICHOST);
> memset(&hints, 0, sizeof(hints));
> hints.ai_flags = AI_NUMERICHOST;
> hints.ai_family = ss.ai_family;
> hints.ai_socktype = ss.ai_socktype;
> getaddrinfo(sock_ip, NULL, &hints, &res);
> 
> And use res to compare if the just connected client is in the list of
> recent tryers.
There is no other way afaik.

> This is TOO complex to be the right way to do it.
Only getxxxxinfo() functions are af-independent, so thre is no other choice.

btw. if servers share that connections database there can be problem
with ipv4-mapped addresses (the same connection will be represented
by 2 entries (one v6 on ipv6 ready ircu server and one ipv4 on ipv4-only
ready server)...

> Horacio J. Peńa

-- 
Arkadiusz Miśkiewicz, AM2-6BONE    [ PLD GNU/Linux IPv6 ]
http://www.t17.ds.pwr.wroc.pl/~misiek/ipv6/   [ enabled ]



Reply to: