Sorry for a delayed reply. Somehow this email went to a different folder. On Fri, Sep 25, 2015 at 12:15 AM, Patrik Flykt <patrik.fl...@linux.intel.com > wrote:
> On Thu, 2015-09-24 at 15:38 -0700, Naveen Singh wrote: > > Isn't the IPv4 or IPv6 address passed as an argument to > > __connman_ntp_start a character array? We would still need to convert > > this character array to the IP addresses and for that we would need to > > know the family. Do you think there is any other way to do this > > without using inet_pton (which requires the family knowledge). Let me > > know. > > Since the string is always an address, a shortcut would be to use > getaddrinfo() directly with hints.ai_flags = AI_NUMERICHOST. This is > what connman_inet_check_ipaddress() does, but in start_ntp() the address > is also needed, not only the address family. > This is what I do but in __connman_ntp_start. > > The point is that the conversion from string to addres and address > family need to be done only when needed to make the patch smaller and > less intrusive. > I got your point. So to keep the patch less intrusive: 1. Do not modify __connman_ntp_start instead modify ntp_start 2. In start_ntp find out family by calling getaddrinfo and use inet_pton to store the correct IP address in timeserver_addr. I will make the changes and provide you the patch tomorrow after testing it on my setup. > > Cheers, > > Patrik > > > > _______________________________________________ > connman mailing list > connman@connman.net > https://lists.connman.net/mailman/listinfo/connman > _______________________________________________ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman