On Mon, Feb 25, 2019 at 09:57:42AM -0700, David Ahern wrote: > On 2/25/19 9:39 AM, Eric Dumazet wrote: > >>> On 02/24/2019 08:12 PM, Hangbin Liu wrote: > >>>> ipv6_mod_enabled() is more safe and gentle to check if ipv6 is disabled > >>>> at running time. > >>> > >>> Why is it better exactly ? > >>> > >>> IPv6 can be enabled on the host, but disabled per device > >>> > >>> /proc/sys/net/ipv6/conf/{name}/disable_ipv6 > >> > >> Sorry, it looks I didn't make it clear in the commit description. > >> This issue only occurs when IPv6 is disabled at boot time as there is > >> no IPv6 route entry. Disable ipv6 on specific interface is not affected. > >> So check ipv6_mod_enabled() is enough and we don't need to worry about > >> the rcu_read_lock or the dev status. > >> > >> Should I update the commit description? > > > > Certainly. Are you telling us skb->dev could be NULL here ? > > > > Because rcu_read_lock() should already be asserted. > > > > Same response as geneve. The existing check is more appropriate and > relevant for the code path: is ipv6 enabled on this device versus is > ipv6 enabled at all.
Hi David, Just as I said, this issue only occurs when IPv6 is disabled at boot time as there is no IPv6 route entry. Disable ipv6 on specific interface should not be affected(IPv6 route/fib has inited). So I think use ipv6_mod_enabled() would be more suitable in this scenario. Did I miss something? Thanks Hangbin