From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 240E1C43381 for ; Mon, 25 Feb 2019 08:18:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA3222084D for ; Mon, 25 Feb 2019 08:18:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OK3KHCwO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726056AbfBYISK (ORCPT ); Mon, 25 Feb 2019 03:18:10 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46337 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbfBYISK (ORCPT ); Mon, 25 Feb 2019 03:18:10 -0500 Received: by mail-pl1-f193.google.com with SMTP id c17so967253plz.13 for ; Mon, 25 Feb 2019 00:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vQGAL72IWylL795iWF8CXitO0pv1ofwZkxxEgcz/hcg=; b=OK3KHCwOhC87rIPiJq980tkZigPP+HFAo+TsHik2jMfq3q4h7SLp8VTsI8pnDN+c2i fHDPElPJkiHKkdUHzZztGTwrCbEKhnvNfuW7aIbXYTE6B2+8IOzP62rArkI3m2fdZN/H w6TpfetKTom7g7+PU0ed/NtabKalgRnaYi3L98fmV/Y6eL+V3CtFnC3LCPpbx9LH5Aoj WwhuU5lek5xRgkhqQhptMdDpC11DuQ9FGy87bLmcT0b54D2H9zvKmqhxJpIpWJTFOx5Y 7POelbywZkhy9loQkAXr07SC2obVwSO88c5+0O4Px7y+2bJTd7mk5FgDU5qBw3PfsqT5 JrQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vQGAL72IWylL795iWF8CXitO0pv1ofwZkxxEgcz/hcg=; b=s3qA6BiERIhZz+DaUyQSvn6gabByS2ueZZG4JNZ1xvNs/jzYqF2cps6SIrgR7nsNxz cu7VKFfraXULr+lwWJF83UUpjtb9SMzkWpqeLJSnSrNyX7EsJZK4pUzSgndH5F49lsmQ VZwovVWngrs0YANUxP5mcil66Sxrj00372q6kk4/JOqs5AGpSNOcUp5g5B3S5yZqsE92 aF2n/BzYdgsDcxO7f+qMC0OUDS/B6OATqT3A7r/rB/HhYKhDkT9ZEilNklwGL7D8/ZDP joJRCKvq931f42T0CDa/+mSv3v3epUj81QZczmxSkPPTzqJ/6wO8s1UmFOr6UjeGUUWG O5AA== X-Gm-Message-State: AHQUAuaY6CK/Mpy7/Zx3jOlvZQK7ktOI5vK9dbal3NTZPvMtMoxkgzdD 6mj+O5LVaDIgTqfqeNAkyR0= X-Google-Smtp-Source: AHgI3IYgTy8CDxoCOAlhBUS/lcJ2P9I5akcehTqelNMc/Mf+vQ5uPCqcHdTtdZBnbbW2bhcMYqofkg== X-Received: by 2002:a17:902:2f:: with SMTP id 44mr18813983pla.44.1551082689379; Mon, 25 Feb 2019 00:18:09 -0800 (PST) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id 195sm1577363pfc.50.2019.02.25.00.18.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 00:18:08 -0800 (PST) Date: Mon, 25 Feb 2019 16:17:59 +0800 From: Hangbin Liu To: Eric Dumazet Cc: netdev@vger.kernel.org, Stefano Brivio , "David S . Miller" , David Ahern Subject: Re: [PATCH net] sit: use ipv6_mod_enabled to check if ipv6 is disabled Message-ID: <20190225081759.GP10051@dhcp-12-139.nay.redhat.com> References: <20190225041243.9753-1-liuhangbin@gmail.com> <7c0f5c9c-d918-de27-643d-416509576be4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7c0f5c9c-d918-de27-643d-416509576be4@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sun, Feb 24, 2019 at 08:24:51PM -0800, 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? Thanks Hangbin > > > > Fixes: 173656accaf5 ("sit: check if IPv6 enabled before calling ip6_err_gen_icmpv6_unreach()") > > Signed-off-by: Hangbin Liu > > --- > > net/ipv6/sit.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c > > index e8a1dabef803..eea1f19985a7 100644 > > --- a/net/ipv6/sit.c > > +++ b/net/ipv6/sit.c > > @@ -546,7 +546,7 @@ static int ipip6_err(struct sk_buff *skb, u32 info) > > } > > > > err = 0; > > - if (__in6_dev_get(skb->dev) && > > + if (ipv6_mod_enabled() && > > !ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4, type, data_len)) > > goto out; > > > >