Subject: Re: [PATCH net-next 01/18] ipv6: Add fib6_nh_init and release to stubs

From: Ido Schimmel <[email-masked]>
Date: Fri, 5 Apr 2019 12:46:21 +0000

On Thu, Apr 04, 2019 at 10:49:50AM -0700, David Ahern wrote:
> From: David Ahern <[email-masked]>
> 
> Signed-off-by: David Ahern <[email-masked]>

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

> +static int eafnosupport_fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
> +				     struct fib6_config *cfg, gfp_t gfp_flags,
> +				     struct netlink_ext_ack *extack)
> +{
> +	NL_SET_ERR_MSG(extack, "IPv6 support not enabled in kernel");
> +	return -EAFNOSUPPORT;
> +}
> +
>  const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
>  	.ipv6_dst_lookup   = eafnosupport_ipv6_dst_lookup,
>  	.ipv6_route_input  = eafnosupport_ipv6_route_input,
> @@ -181,6 +189,7 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
>  	.fib6_lookup       = eafnosupport_fib6_lookup,
>  	.fib6_multipath_select = eafnosupport_fib6_multipath_select,
>  	.ip6_mtu_from_fib6 = eafnosupport_ip6_mtu_from_fib6,
> +	.fib6_nh_init	   = eafnosupport_fib6_nh_init,
>  };

I thought this would explode in fib_check_nh_v6_gw() if IPv6 is not
enabled because fib6_nh_release() is NULL, but you actually check that
earlier in fib_gw_from_via(), so it's fine.

BTW, the error message in that case is "IPv6 support is not enabled in
this kernel", which is a bit different from what you have here. Might be
a good idea to be more consistent about it.