On 4/5/19 6:46 AM, Ido Schimmel wrote:
> On Thu, Apr 04, 2019 at 10:49:50AM -0700, David Ahern wrote:
>> From: David Ahern <dsah...@gmail.com>
>>
>> Signed-off-by: David Ahern <dsah...@gmail.com>
> 
> Reviewed-by: Ido Schimmel <ido...@mellanox.com>
> 
>> +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.

The intent is that since fib6_nh_init fails fib6_nh_release should not
be called hence a not-supported stub should not be needed.

> 
> 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.
> 

ah, patch 17. Yes, will make consistent.

Reply via email to