Hi,

On Tue, 2015-03-24 at 02:20 +0100, Tore Anderson wrote:
> I could of course improve this third issue by making connman not add
> the default router as an NTP server if option 42 was received.

That is what I had in mind after the discussion in JIRA on CM-674.

> However IMHO that would only make the behaviour "less wrong", it would
> certainly not be "right". The bottom line is that the NTP service and
> default router addresses are two completely independent things that
> should not be confused, just like you shouldn't confuse the addresses
> of the DNS service, DHCP service, or any of the other 100+ different
> things it is possible to advertise in DHCP.

First of all, NTP and default gateway roles are not confused. The
gateway has always been intentionally added to the set of NTP servers to
serve as a decent default entry that is as close as possible. This
behavior has nothing to do with any RFCs or other documents, it's just
an observation that is known to work in real life.

The code is written to add service specific NTP servers first, then the
gateway and last but not least the fallback NTP servers. Here the
service specific NTP servers are either obtained via DHCP or manually
set. When ConnMan starts, it takes the first server from the list into
use and proceeds to the next one only if there were no replies from the
current one. So if ConnMan ends up sending NTP packets to the gateway,
it means there were no service specific NTP servers or then the service
specific NTP servers were incorrectly set up. If the default gateway
does not answer, the fallback NTP servers are used next.

Instead of adding more options to main.conf, the following oneliner
makes the situation a bit smarter:

--- a/src/timeserver.c
+++ b/src/timeserver.c
@@ -205,7 +205,7 @@ GSList *__connman_timeserver_get_all(struct
connman_service *service)
                list = __connman_timeserver_add_list(list,
service_ts[i]);
 
        network = __connman_service_get_network(service);
-       if (network) {
+       if (!service_ts && network) {
                index = connman_network_get_index(network);
                service_gw =
__connman_ipconfig_get_gateway_from_index(index,
                        CONNMAN_IPCONFIG_TYPE_ALL);


HTH,

        Patrik


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

Reply via email to