From patchwork Mon Jan 8 09:41:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dichtel X-Patchwork-Id: 13513213 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wr1-f97.google.com (mail-wr1-f97.google.com [209.85.221.97]) (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 5E97C12B6C for ; Mon, 8 Jan 2024 09:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=6wind.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=6wind.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=6wind.com header.i=@6wind.com header.b="UiwqmSFF" Received: by mail-wr1-f97.google.com with SMTP id ffacd0b85a97d-3376d424a79so302466f8f.1 for ; Mon, 08 Jan 2024 01:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1704706864; x=1705311664; 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; bh=tqm8T6ZJilGE+jPbAasz3dYt01ixeTiw6V7R5wFltv4=; b=UiwqmSFF3c+FLWWOU69nd4YF7hzGVkR61HubNl7UewJ+FcUCRg1pWlaRZ2+NVg+hKc 0uK6SrDwXRPHV0l+P6T9KsmDKaZZcjjm5aFPqCbk3EswlgZPyCCeOcAlz4JQTLBWSpFq Ol1EaYrE8LhhnTLRgSTu5vsF91cWSeCEPo7/a8Oa94MhOrgmFytjjPj286FuFLHQhImL MIDWXlf7jtzmk/TZPe5ng9eOAF70jI6TY4i2tb7nWe/e1AnZjHiDh1gmNaGcjFB+QuSa oqDo8P8rMwUj6QoKmJH+3hyooU5uw6aG7p9vZAYBdWF2Fmu/3pUtuP3CIIEU7GTZRvBI RlTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704706864; x=1705311664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tqm8T6ZJilGE+jPbAasz3dYt01ixeTiw6V7R5wFltv4=; b=NVav9l9JAJ2MgfjxHThkwZOjuKkyfebW472VcG3xpMwlpD1c5+IenBZ9+3aFTaSAEc iNbpD89F8zpUO69+FtuyOiTLrX9T9RZxrVD5X5txpwANlgZo1RROAwnZN3T4bK/IoFZX 0Vw5Yt8dQjDUGRQYb+bWrJQRL0j7evsMLfaQ5agBpcN3a8p6bVmv1wjdZ+P4eadCcZOK xVC0yNKUT+vFB20d1eayOgPzoa83i4rqa5bztIchfebKn3ssLnaoQk2G7AtogiNvvz+X IBitobnkiuSQPNiY150/JkdYsKXynIEgrCpkvi3kz/jt1SmR5HuH4uu/wLDxHYFbeEq4 T3dw== X-Gm-Message-State: AOJu0YxMKOAb/H6OIc7HBfHkhVeyrSvI6dyLRLqRiauEJ0kyLMeBI4wF E6Yrr1r0zuDgYOGueIIi6yZ1CKdsadZK3syK8FlCAUL31E88cL5bxEl2mA== X-Google-Smtp-Source: AGHT+IEGYqCa3uqlQ/n8N3+SJuTlMWe4RkG6fop1gZ3cyiPRm0yClTlYfRj9ztkelTbGVOKxJT/K/vZQCn5E X-Received: by 2002:a05:6000:188b:b0:337:6804:446d with SMTP id a11-20020a056000188b00b003376804446dmr1432569wri.72.1704706864495; Mon, 08 Jan 2024 01:41:04 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id bt28-20020a056000081c00b003372c0d3e4csm391867wrb.78.2024.01.08.01.41.04; Mon, 08 Jan 2024 01:41:04 -0800 (PST) X-Relaying-Domain: 6wind.com Received: from bretzel (bretzel.dev.6wind.com [10.17.1.57]) by smtpservice.6wind.com (Postfix) with ESMTPS id 3CFF760106; Mon, 8 Jan 2024 10:41:04 +0100 (CET) Received: from dichtel by bretzel with local (Exim 4.94.2) (envelope-from ) id 1rMm7z-008OeG-Uy; Mon, 08 Jan 2024 10:41:03 +0100 From: Nicolas Dichtel To: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Phil Sutter , David Ahern , Jiri Pirko Cc: netdev@vger.kernel.org, Nicolas Dichtel , stable@vger.kernel.org Subject: [PATCH net v4 1/2] Revert "net: rtnetlink: Enslave device before bringing it up" Date: Mon, 8 Jan 2024 10:41:02 +0100 Message-Id: <20240108094103.2001224-2-nicolas.dichtel@6wind.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240108094103.2001224-1-nicolas.dichtel@6wind.com> References: <20240108094103.2001224-1-nicolas.dichtel@6wind.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org This reverts commit a4abfa627c3865c37e036bccb681619a50d3d93c. The patch broke: > ip link set dummy0 up > ip link set dummy0 master bond0 down This last command is useful to be able to enslave an interface with only one netlink message. After discussion, there is no good reason to support: > ip link set dummy0 down > ip link set dummy0 master bond0 up because the bond interface already set the slave up when it is up. Cc: stable@vger.kernel.org Fixes: a4abfa627c38 ("net: rtnetlink: Enslave device before bringing it up") Signed-off-by: Nicolas Dichtel Reviewed-by: Jiri Pirko Reviewed-by: Hangbin Liu --- net/core/rtnetlink.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index e8431c6c8490..bf4c3f65ad99 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -2905,13 +2905,6 @@ static int do_setlink(const struct sk_buff *skb, call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); } - if (tb[IFLA_MASTER]) { - err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]), extack); - if (err) - goto errout; - status |= DO_SETLINK_MODIFIED; - } - if (ifm->ifi_flags || ifm->ifi_change) { err = dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm), extack); @@ -2919,6 +2912,13 @@ static int do_setlink(const struct sk_buff *skb, goto errout; } + if (tb[IFLA_MASTER]) { + err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]), extack); + if (err) + goto errout; + status |= DO_SETLINK_MODIFIED; + } + if (tb[IFLA_CARRIER]) { err = dev_change_carrier(dev, nla_get_u8(tb[IFLA_CARRIER])); if (err) From patchwork Mon Jan 8 09:41:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dichtel X-Patchwork-Id: 13513211 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f100.google.com (mail-lf1-f100.google.com [209.85.167.100]) (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 8E30C12B99 for ; Mon, 8 Jan 2024 09:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=6wind.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=6wind.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=6wind.com header.i=@6wind.com header.b="V6tQasb5" Received: by mail-lf1-f100.google.com with SMTP id 2adb3069b0e04-50e8ca6c76dso1552916e87.3 for ; Mon, 08 Jan 2024 01:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1704706864; x=1705311664; 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; bh=e8G+K5fy0HhUmQ3VUPZS+WOaF1lcIx6Tgk5vqHUVYxE=; b=V6tQasb5HYkdRJvsh+Ox36h2OJQYl6nu36Jy5qlA37IzZGqbJwkfuOxvkE4e04Wptd idZIvskBSCO4nTo/svzOoFvwz+CbUpLTA5Mjd6vyOGyLP206MqX1aXMa+pNQiNSIRq8k qCIIO7TwPy0VdK2V+354HzOpoekGEyaaqY9s1M6tClKRkQEd+Hg2BeoLx77qKFyGWAgd UKs5FolhISBIExT2bfyNRIXe3QH01IiT+SzzANzCSqp6/abQ4l8kY4BK7LWaiWhpIwI5 nufdqg9u893nByuQtoXDDvYpKYXsTpJg8Uqa2Q6RCeWsXhnc2d7KVEhixv4lEJh7mfSO R7ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704706864; x=1705311664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e8G+K5fy0HhUmQ3VUPZS+WOaF1lcIx6Tgk5vqHUVYxE=; b=wITRzt8PZtWITyYJcPD4fRQvYQ2iM4hBCFnH2PNxPMj503E2YlAMEQWMzskZa7k/vg BxlKPl+1XJoq5BL6buKO0XcM0/3ne7xT1gBodTsJzXUmNCUdYacuMsGSafrVMKIEblYH hbvy9ZtUQShcfxjOvdEn91NMRgw84MctXg9+r871EfHJVZO51jrtz+WY48/o6EVKCqDh CMXa7Oo2xAPeGFV96piA4MnEatajc6AtLndoWCG45MEv4sRcbLPbarQN6d2Q8GUMx1Y/ II07pli0mAT1AKYnwO3/OllqiIKx6sDv8WkiBml/R4G4G4znX3unlb12Lxc9O5NU57+I TlkQ== X-Gm-Message-State: AOJu0Yz9j4Wp1WpUgnJGeRYLWuTXc0tezkrK1jFselqMQNx3wuylAvTP d7VncXnhhMxWj2fEH0zQxI6Nh+bmG1plphm/w9oEFjnUkTAJgh8s7CZDRQ== X-Google-Smtp-Source: AGHT+IGHk93Ajrt7mQzwRhOoVXLmW/aJqd1fhyT7ilckS5nYvC+nsDIi8YmdpuFsZZn2a5QUu//twZBjkCmG X-Received: by 2002:a19:e055:0:b0:50e:55fc:1e3f with SMTP id g21-20020a19e055000000b0050e55fc1e3fmr941253lfj.135.1704706864559; Mon, 08 Jan 2024 01:41:04 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id c2-20020a056000184200b00336d3101131sm337033wri.40.2024.01.08.01.41.04; Mon, 08 Jan 2024 01:41:04 -0800 (PST) X-Relaying-Domain: 6wind.com Received: from bretzel (bretzel.dev.6wind.com [10.17.1.57]) by smtpservice.6wind.com (Postfix) with ESMTPS id 48C0660264; Mon, 8 Jan 2024 10:41:04 +0100 (CET) Received: from dichtel by bretzel with local (Exim 4.94.2) (envelope-from ) id 1rMm7z-008OeJ-VX; Mon, 08 Jan 2024 10:41:03 +0100 From: Nicolas Dichtel To: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Phil Sutter , David Ahern , Jiri Pirko Cc: netdev@vger.kernel.org, Nicolas Dichtel Subject: [PATCH net v4 2/2] selftests: rtnetlink: check enslaving iface in a bond Date: Mon, 8 Jan 2024 10:41:03 +0100 Message-Id: <20240108094103.2001224-3-nicolas.dichtel@6wind.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240108094103.2001224-1-nicolas.dichtel@6wind.com> References: <20240108094103.2001224-1-nicolas.dichtel@6wind.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The goal is to check the following two sequences: > ip link set dummy0 up > ip link set dummy0 master bond0 down Signed-off-by: Nicolas Dichtel Reviewed-by: Jiri Pirko --- tools/testing/selftests/net/rtnetlink.sh | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index 26827ea4e3e5..bbf9d2bd3d7b 100755 --- a/tools/testing/selftests/net/rtnetlink.sh +++ b/tools/testing/selftests/net/rtnetlink.sh @@ -28,6 +28,7 @@ ALL_TESTS=" kci_test_neigh_get kci_test_bridge_parent_id kci_test_address_proto + kci_test_enslave_bonding " devdummy="test-dummy0" @@ -1239,6 +1240,33 @@ kci_test_address_proto() return $ret } +kci_test_enslave_bonding() +{ + local testns="testns" + local bond="bond123" + local dummy="dummy123" + local ret=0 + + run_cmd ip netns add "$testns" + if [ $ret -ne 0 ]; then + end_test "SKIP bonding tests: cannot add net namespace $testns" + return $ksft_skip + fi + + run_cmd ip -netns $testns link add dev $bond type bond mode balance-rr + run_cmd ip -netns $testns link add dev $dummy type dummy + run_cmd ip -netns $testns link set dev $dummy up + run_cmd ip -netns $testns link set dev $dummy master $bond down + if [ $ret -ne 0 ]; then + end_test "FAIL: initially up interface added to a bond and set down" + ip netns del "$testns" + return 1 + fi + + end_test "PASS: enslave interface in a bond" + ip netns del "$testns" +} + kci_test_rtnl() { local current_test