Subject: Re: [PATCH net-next 07/18] ipv4: Add support to fib_config for IPv6 gateway

From: Ido Schimmel <[email-masked]>
Date: Fri, 5 Apr 2019 14:00:00 +0000

On Thu, Apr 04, 2019 at 10:49:56AM -0700, David Ahern wrote:
> From: David Ahern <[email-masked]>
> 
> Add support for an IPv6 gateway to fib_config. Since a gateway is either
> IPv4 or IPv6, make it a union with fc_gw4 where fc_gw_family decides
> which address is in use. Update current checks on family and gw4 to
> handle ipv6 as well.
> 
> Signed-off-by: David Ahern <[email-masked]>

Reviewed-by: Ido Schimmel <[email-masked]>

See one note below

> -		     fi->fib_nh->fib_nh_gw4 != cfg->fc_gw4)) {
> +		     fi->fib_nh->fib_nh_gw4 != cfg->fc_gw4) ||
> +		    (cfg->fc_gw_family == AF_INET6 &&
> +		     ipv6_addr_cmp(&fi->fib_nh->fib_nh_gw6, &cfg->fc_gw6))) {
>  			NL_SET_ERR_MSG(extack,
>  				       "Nexthop gateway does not match RTA_GATEWAY");

Given that you can now specify a gateway with either RTA_GATEWAY or
RTA_VIA it might make sense to adjust this message.

>  			goto errout;
> @@ -745,6 +758,10 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi,
>  		    cfg->fc_gw4 != fi->fib_nh->fib_nh_gw4)
>  			return 1;
>  
> +		if (cfg->fc_gw_family == AF_INET6 &&
> +		    ipv6_addr_cmp(&cfg->fc_gw6, &fi->fib_nh->fib_nh_gw6))
> +			return 1;
> +
>  		return 0;
>  	}
>  
> -- 
> 2.11.0
>