From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84FC9469826 for ; Fri, 7 Aug 2026 22:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786140610; cv=none; b=I66Mlke2pZdUEI0lgu/BOEZmXwSyXjW0s7mQG9KhcFRDt2XbVGPb48VWEvjqMr7E5zASMxgo8FYR9tdhMB389gRy+Y8/sReEM0yhHqFufEaX4BAYFKVqCgPzGeHVq/Ty2xoKMDFU6hexw27Tx+2jILAIDaaR3Gvk7FmWJ2MnlYo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786140610; c=relaxed/simple; bh=yrKxam1mAG3nYRnHckVi5zYwUOS6b+SZe0OPFHhASsc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nRVasDWJm0UIt0aDlNYKs9b4Nl3fA+XHzDN+hhunUBwslTjGxMiAAQ+R2APvNdJpn6I2jB9Nj1hGsZuQKM5JRjDb6VX0dwuIV1vOoYhMfFom6Hge6fclBUtKmO6IoULic7pk0fn/owrJDUk9mnUiazTALyam4gQZi0X/RbbbOXg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hOCrL47+; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hOCrL47+" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2cc7ef7ec27so814515ad.1 for ; Fri, 07 Aug 2026 15:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786140606; x=1786745406; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VyWHUTu1TvU3eL62Q6jwzEcXDxMtIPq0Po9Uu+hdpt8=; b=hOCrL47+IIu1e36eWx3T+TwxitHvaTaSJAIbMMTcoZmkU50btaHR7FSFjNyjOvbVkw gtRck0M6kwES4P1S978uXxaYu4ZtPgVY7DLhSatFymjptZTb9Ayrbi9VddhF2DRAmzJN EN+KowU8zTkeASDREGB9KuH5Th2vloWC1gkOsloqdmz2NmYGGX5dQyp4vQVo7i0B7yF5 uK0plgyEv5AjZ7vTuu56O1z/tjTjnEYHZ/NhRkALGKE/mHlPpspOJiwfX2CILgmmhrIv Z9g/9YkIlv3mo6phdH/y4q+J8K6xfHKBOR5niA450kFmvql9vM7OLZ9eGLXDRm/Nbe3y 22OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786140606; x=1786745406; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=VyWHUTu1TvU3eL62Q6jwzEcXDxMtIPq0Po9Uu+hdpt8=; b=n56s7eByZ5YyDfvW/e6XdbmWaeMfptwD8DJ0W8BbF3LFbFBEoKUFFoNnQtbcd3WS2T FAR2U+j8eKfuP+981kXDuPHGGBQ5aBjNquCeawcB9eSngyx6QsRM7+kX7VTbPfaI+QW6 z0b2Nr+niRq0CgCxunjjJIl8lc8ryAdyWlZp5ViN1sSJdy6JE8CSgcRjtGvtDXGhXo0g ioy3jAMqIBdzRLrZhrnLnuxtPQ5L8YugH0Aapojrx8DIS/e4N/Z7/je5HSy1LSVyFS2D NnZK4ZmSDTjGnD2Yn3hQUcaANDszbl+/vcD9o82ZjUVKk+6+lqm+KyYczQWoGsuGhQ6f RMvw== X-Forwarded-Encrypted: i=1; AHgh+RopP3lww3J7z2lLXB5cL7xutGaEg9caTr+oNZl8ad4ed+Q1kcNUKif6W0FOkCasTd7kijz6jLRlXe0daO4=@vger.kernel.org X-Gm-Message-State: AOJu0YzNRaQ81Vt60tR97lfS6dJZMVeDkp6aq54vQf9CNZQo8OMgGCmZ n+v426ComoG62R3tDDgoQnZyKc576+KEaSlR9Ey6eRDAQ3feR2xxNgXZcjI37xK8 X-Gm-Gg: AR+sD13qJ/QoXM2LVOsKpWhfL7s7SPIxs+OQZEDlUjx3iICsyCGPWKRNBLuqrnd7F9h OZ7E0hUGWj/4BPmeYVh8UE0RRKSLbDoqgwMLe4PC0oq+grlcBPu+gs1Npokv8c3R9VjrVuznxKW MtoTFScUbw4C8Sj3yrPgmuH0SQsKOyixx623aMHvXTP1UWuMRMSxIy11zF9vccGZBK5nYlop8Nt vxckXBf+z+iT4YnKITWSjdpQZKRuJPTOn/WErDLvDRymAzjvKVxznDGvayVT/fbJnT2Iiym5q2Q 0+gffkquM2P2EK96K8csWLkGHQWZXX83crz5I+5sEMciYMR1hJAC9mBOVcuM1OJJLIjetey2UO+ QM9HuCVolpoyOGV/f49Yros0SE2668TwWLdgUjcIasplVqUb4Zu5GgDZhVyzRK+aByxURI74VYK Xh7lTKLxVk9gos4xCAW+UE5o6blJ2xq75X8y9KI7yqJpNT8kY3qfAvJYfoWlR1QNpfnA== X-Received: by 2002:a17:902:ced0:b0:2c9:cb1b:64d6 with SMTP id d9443c01a7336-2d2a8e9ded1mr49060655ad.19.1786140606491; Fri, 07 Aug 2026 15:10:06 -0700 (PDT) Received: from fedora ([2804:1b3:a8c3:8ee5:1c39:64d9:e257:73dc]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-315be568bd3sm11182762eec.0.2026.08.07.15.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 15:10:06 -0700 (PDT) From: Marcelo Mendes Spessoto Junior To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Marcelo Mendes Spessoto Junior Subject: [PATCH net-next v3 3/5] selftests: net: create own netns in ipv6_flowlabel_mgr Date: Fri, 7 Aug 2026 19:09:40 -0300 Message-ID: <20260807220942.421382-4-marcelomspessoto@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807220942.421382-1-marcelomspessoto@gmail.com> References: <20260807220942.421382-1-marcelomspessoto@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Have ipv6_flowlabel_mgr create and configure its own network namespace (unshare(CLONE_NEWNET) + bring up lo), the same way ipv6_fragmentation.c and icmp_rfc4884.c already do, instead of relying on the in_netns.sh wrapper script. The setup can then be reused across tests through fixtures and provide isolated network environments for each test in the case of a future adoption of kselftest_harness. It also avoids the leak of modifications to the netns in case the user runs the test file directly, outside the wrapper and without the in_netns.sh file. Signed-off-by: Marcelo Mendes Spessoto Junior --- tools/testing/selftests/net/ipv6_flowlabel.sh | 2 +- .../selftests/net/ipv6_flowlabel_mgr.c | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/ipv6_flowlabel.sh b/tools/testing/selftests/net/ipv6_flowlabel.sh index cee95e252bee..2eeda39bf64c 100755 --- a/tools/testing/selftests/net/ipv6_flowlabel.sh +++ b/tools/testing/selftests/net/ipv6_flowlabel.sh @@ -8,7 +8,7 @@ set -e echo "TEST management" -./in_netns.sh ./ipv6_flowlabel_mgr +./ipv6_flowlabel_mgr echo "TEST datapath" ./in_netns.sh \ diff --git a/tools/testing/selftests/net/ipv6_flowlabel_mgr.c b/tools/testing/selftests/net/ipv6_flowlabel_mgr.c index 51541e792257..f8d8b09b9d86 100644 --- a/tools/testing/selftests/net/ipv6_flowlabel_mgr.c +++ b/tools/testing/selftests/net/ipv6_flowlabel_mgr.c @@ -8,11 +8,14 @@ #include #include #include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -306,6 +309,30 @@ static void run_tests(int fd) } } +static void setup(void) +{ + struct ifreq ifr = { + .ifr_name = "lo" + }; + int ctl; + + if (unshare(CLONE_NEWNET)) + error(1, errno, "unshare"); + + ctl = socket(AF_LOCAL, SOCK_STREAM, 0); + if (ctl == -1) + error(1, errno, "socket"); + + if (ioctl(ctl, SIOCGIFFLAGS, &ifr)) + error(1, errno, "ioctl SIOCGIFFLAGS"); + ifr.ifr_flags |= IFF_UP; + if (ioctl(ctl, SIOCSIFFLAGS, &ifr)) + error(1, errno, "ioctl: bring lo up"); + + if (close(ctl)) + error(1, errno, "close"); +} + static void parse_opts(int argc, char **argv) { int c; @@ -329,6 +356,7 @@ int main(int argc, char **argv) int fd; parse_opts(argc, argv); + setup(); fd = socket(PF_INET6, SOCK_DGRAM, 0); if (fd == -1) -- 2.55.0