On Mon, 2015-10-05 at 10:49 +0300, Jukka Rissanen wrote:
> > Exactly this is what I am saying.My concern is for the type of
> > timeserver_addr which is used for storing the IP address of the
> > server. It cannot be sockaddr. It needs to be sockaddr_storage.
> Where
> > we know what IP address we are using we can use sockaddr_in or
> > sockaddr_in6 and hen cast it to sockaddr *.
>
>
> Normally in socket programming you instantiate either sockaddr_in or
> sockaddr_in6 variable, and then cast sockaddr * to that variable and
> pass that pointer around. At least I would prefer that way instead of
> creating sockaddr_storage variable for this purpose. So in practice
> there is no need to create sockaddr_storage variable.
And as we know that a sockaddr_in6 has the space to hold also
sockaddr_in, sockaddr_in6 is a decently sized data structure to hold all
addresses. Provide this sockaddr_in6 as a sockaddr * to the functions.
They can cast it back to the needed type.
Cheers,
Patrik
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman