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=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED 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 F044EC43387 for ; Fri, 18 Jan 2019 14:39:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0DDA2087E for ; Fri, 18 Jan 2019 14:39:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cKS35ULX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727761AbfAROjN (ORCPT ); Fri, 18 Jan 2019 09:39:13 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:35756 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbfAROjN (ORCPT ); Fri, 18 Jan 2019 09:39:13 -0500 Received: by mail-ot1-f66.google.com with SMTP id 81so14585130otj.2 for ; Fri, 18 Jan 2019 06:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=h/rUOvKNRDF5km8OG/cULcN6N4rvxwrNgGclIitUklI=; b=cKS35ULX3Q0wqgUOjG8kUZOBHV9HxZ5SbSPu1RnqRnTiO45+1b5j7HDWA6vnLGsJra QeW6rRZz9bd7OWPOv/834qL6z241F5E7O/Z5TJbyguuO4iud4NhlwWYh6QqDo3iR3Ddl qsWPEgOzkCZU3ox4o4XVjmq4p3MVOnAVUjxbel40ICPAS1F2Bi09Kr+4PDyT7WCJ7Lz1 eb1OtGTnFw1k5C+AIzdCAX7hZwkWSW9EdC6t9/mQ93gSpzpm80iSohSpy6kNZHoXSZ9I SlYdp2HowN5RRJT85fvbtBZ2R+eXp0UPaKWxFIotzMURn3tqPdpsdz7pqnbwvswQMywh 13DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=h/rUOvKNRDF5km8OG/cULcN6N4rvxwrNgGclIitUklI=; b=j50y7rZLsIptYfWIEQN6GsgpJl2aiaVqtwF0nCgSy3OKDDJP9QSkB+P+IINez1vA4Y Jnn1O/fNKpV7IJXAr8LDE8W1vfifD+ikkblBCbRvnIu23lRJWvkdSw+dDOMh4xKPxXUo zFnexANX17s/eCbJYjkEPwBbGfhrM/urj7wEzLfcKetSBrH8YIAhpkD6M29U3O0K/tp+ 9ta+tNFV+vXzVcuql7tlz/IUdjhJswfrn1z1/tU78yFNOSfhaPwGN+brjNY2GZ9IS/wQ yy1zZbe1WrvmiNIv46mEFk8kX2gtpoesooFJMu3iwQtWhX5lf3lejjvf1LLNqNRpTIvH BB3Q== X-Gm-Message-State: AJcUukcePefcyx5ft9D5wY6sTOpCsxgVNzEWPHLUsyHL1yvLa2Hj+Otm pbbraZLIFseM2LylQA2vFxssIfUh9LRap2biS9k= X-Google-Smtp-Source: ALg8bN7LK7qawuuyF6JEX9OXLgISjexG8+pqAdecmk6cpyybVWO2xYm3VRQb07ZUAKLUj/ITh25S7PJ7es+pBCRISbc= X-Received: by 2002:a9d:e8c:: with SMTP id 12mr12118564otj.297.1547822352260; Fri, 18 Jan 2019 06:39:12 -0800 (PST) MIME-Version: 1.0 References: <20190118072711.491-1-xiyou.wangcong@gmail.com> In-Reply-To: From: Tonghao Zhang Date: Fri, 18 Jan 2019 22:38:35 +0800 Message-ID: Subject: Re: [Patch net-next] net: introduce a knob to control whether to inherit devconf config To: Nicolas Dichtel Cc: Cong Wang , Linux Kernel Network Developers , Zhu Yanjun Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Jan 18, 2019 at 4:25 PM Nicolas Dichtel wrote: > > Le 18/01/2019 =C3=A0 08:27, Cong Wang a =C3=A9crit : > > There have been many people complaining about the inconsistent > > behaviors of IPv4 and IPv6 devconf when creating new network > > namespaces. Currently, for IPv4, we inherit all current settings > > from init_net, but for IPv6 we reset all setting to default. > > > > This patch introduces a new /proc file > > /proc/sys/net/core/devconf_inherit_init_net to control the > > behavior of whether to inhert sysctl current settings from init_net. > > This file itself is only available in init_net. > > > > As demonstrated below: > > > > Initial setup in init_net: > > # cat /proc/sys/net/ipv4/conf/all/rp_filter > > 2 > > # cat /proc/sys/net/ipv6/conf/all/accept_dad > > 1 > > > > Default value 0 (current behavior): > > # ip netns del test > > # ip netns add test > > # ip netns exec test cat /proc/sys/net/ipv4/conf/all/rp_filter > > 2 > > # ip netns exec test cat /proc/sys/net/ipv6/conf/all/accept_dad > > 0 > > > > Set to 1 (inherit from init_net): > > # echo 1 > /proc/sys/net/core/devconf_inherit_init_net > > # ip netns del test > > # ip netns add test > > # ip netns exec test cat /proc/sys/net/ipv4/conf/all/rp_filter > > 2 > > # ip netns exec test cat /proc/sys/net/ipv6/conf/all/accept_dad > > 1 > > > > Set to 2 (reset to default): > > # echo 2 > /proc/sys/net/core/devconf_inherit_init_net > > # ip netns del test > > # ip netns add test > > # ip netns exec test cat /proc/sys/net/ipv4/conf/all/rp_filter > > 0 > > # ip netns exec test cat /proc/sys/net/ipv6/conf/all/accept_dad > > 0 > > > > Set to a value out of range (invalid): > > # echo 3 > /proc/sys/net/core/devconf_inherit_init_net > > -bash: echo: write error: Invalid argument > > # echo -1 > /proc/sys/net/core/devconf_inherit_init_net > > -bash: echo: write error: Invalid argument > > > > Reported-by: Zhu Yanjun > > Reported-by: Tonghao Zhang > > Cc: Nicolas Dichtel > > Signed-off-by: Cong Wang > Nice! > > Acked-by: Nicolas Dichtel Acked-by: Tonghao Zhang