Hi Forest,

On Thu, Jul 01, 2010 at 07:16:09PM -0400, Forest Bond wrote:
> Host routes are added for nameservers whenever the nameservers for
> a service are updated.  The ensures that nameservers are always
> reachable as long as a service is online, even if the default
> route changes.
> 
> In particular, this fixes problems with the DNS proxy when the
> nameservers are not on a local subnet.  Since nameservers are added,
> to the resolver before the default route is set up, the DNS proxy
> would fail to connect to the nameservers as they were not yet
> reachable.
Some comments:

> diff --git a/src/connection.c b/src/connection.c
> index 154076b..5546a82 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -277,6 +277,7 @@ static int connection_probe(struct connman_element 
> *element)
>       }
>  
>       service = __connman_element_get_service(element);
> +     __connman_service_set_gateway(service, gateway);
I don't particularily like having a service gateway pointer.
Have you considered setting the nameserver host routes from
__connman_service_append_nameserver(). All the callers know the underlying
gateway (if any) and you could pass it as an argument to the above routine.

> diff --git a/src/service.c b/src/service.c
> index fd694e8..fed9ff5 100644
> --- a/src/service.c
> +++ b/src/service.c
> @@ -78,6 +78,7 @@ struct connman_service {
>       struct connman_network *network;
>       char **nameservers;
>       char *nameserver;
> +     char *gateway;
>       char **domains;
>       /* 802.1x settings from the config files */
>       char *eap;
> @@ -298,6 +299,39 @@ static connman_bool_t is_connected(const struct 
> connman_service *service)
>       return FALSE;
>  }
>  
> +static int add_nameserver_host_route(struct connman_service *service,
> +                                             const char *nameserver)
> +{
> +     int index;
> +
> +     index = connman_network_get_index(service->network);
> +     if (service->gateway != NULL)
> +             return connman_inet_add_host_route_with_gateway(index,
> +                                     service->gateway, nameserver);
> +     else
> +             return connman_inet_add_host_route(index, nameserver);
> +}
This one would be nicer if integrated into a single inet.c host route setting
routine, connman_inet_add_host_route() that would take an aditional gateway
argument and set the rt_gateway address to ANY if the gateway argument is
NULL.
You would also then get rid of the existing connman_inet_add_host_route_vpn()
one.


> +static int del_nameserver_host_route(struct connman_service *service,
> +                                             const char *nameserver)
> +{
> +     int index;
> +     index = connman_network_get_index(service->network);
> +     return connman_inet_del_host_route(index, nameserver);
> +}
This one should be part of del_all_nameserver_host_routes().

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to