On Tue, 2014-09-23 at 11:56 +0530, Saurav Babu wrote:
> In Dual Network where both IPv4 and IPv6 networks are available,
> gateway address should be set for both network types.
> Currently in following scenario:
> - Gateway Address for IPv6 is already available
> - IPv4 gateway address is obtained using DHCP.
> active_gateway is not NULL as IPv6 gateway was set previously and was
> made active so IPv4 Gateway Address is never set. So we should check if
> gateway address of the type is active or not, if it is not active then
> we should set that gateway address for that type.
> ---
> src/connection.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/connection.c b/src/connection.c
> index 8fe9725..03adbd1 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -908,7 +908,8 @@ int __connman_connection_gateway_add(struct
> connman_service *service,
> new_gateway->ipv6_gateway->vpn = false;
> }
>
> - if (!active_gateway) {
> + if (!active_gateway || !active_gateway->ipv4_gateway->active ||
> + !active_gateway->ipv6_gateway->active) {
This can crash, as ipv[46]_gateway can also be NULL. When it does not
crash, it selects the new gateway whenever either IPv6 or IPv4 gateway
is not active, which is not what we want. The proper check needs to be
done in find_active_gateway(), if the check is somehow faulty.
> set_default_gateway(new_gateway, type);
> goto done;
> }
Cheers,
Patrik
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman