On Thu, 2015-09-24 at 11:14 +0300, Patrik Flykt wrote:
> > +
> > +     if (ret) {
> > +             connman_error("cannot get the server info");
> > +             return -1;
> > +     }
> > +
> > +     family = info->ai_family;
> > +     if (family == AF_INET) {
> > +             if (inet_pton(family, server, &(((struct sockaddr_in 
> > *)&timeserver_addr)->sin_addr.s_addr)) == 0) {
> > +                     connman_error("cannot convert ip address string");
> > +                     return -1;
> > +             }
> > +     } else if (family == AF_INET6) {
> > +             if (inet_pton(family, server, ((struct sockaddr_in6 
> > *)&timeserver_addr)->sin6_addr.__in6_u.__u6_addr8) == 0) {
> > +                     connman_error("cannot convert ipv6 address string");
> > +                     return -1;
> > +             }
> > +     } else {
> > +             connman_error("Neither IPv4 nor IPv6 type");
> > +             return -1;
> 
> This check has already happened in src/service.c, set_property() and
> thus need not be re-done here. It is not done in src/clock.c
> set_property(), neither for the main.conf FallbackTimeservers, so those
> parts need a new patch each.

Let me correct my comment above. Timeservers can also be specified using
host names, so no IP address checks need to be done in the above places.

src/timeservers.c has the code to figure out whether name resolution is
needed or whether the given name is an IP address. So
__connman_ntp_start() can therefore always expect to get either an IPv4
or an IPv6 address.

Cheers,

        Patrik

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to