[PATCH 13/13] connection: Try to avoid having two default gateways

Patrik Flykt patrik.flykt at linux.intel.com
Tue Feb 14 03:25:40 PST 2012


On Thu, 2012-02-02 at 14:54 +0200, Jukka Rissanen wrote:
> +               if (candidate->ipv4_gateway != NULL &&
> +                               candidate->ipv4_gateway->active == TRUE &&
> +                               candidate->order > data->order) {
> +                       DBG("ipv4 downgrading this %p", data);
> +                       unset_default_gateway(data,
> +                                               CONNMAN_IPCONFIG_TYPE_IPV4);
> +                       downgraded = TRUE;
> +               }

If the candidate->order is less than or equal to data->order, then
candidate->ipv4_gateway->active is left as TRUE. Is that a good thing or
a bad thing?

Also, data->ipv4_gateway->active will be TRUE in set_default_gateway()
if data->ipv4_gateway->vpn is also TRUE. Is that on purpose?

You could have slightly more descriptive names in this patch, find_me is
probably more a 'lookup_gateway_data' and I think 'shuffle' in this
context is more like choose/find/downgrade_current, as the variable
inside shuffle is 'downgraded' but in the calling function 'found' is



More information about the connman mailing list