From patchwork Fri Apr 15 16:53:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Fourcot X-Patchwork-Id: 12815203 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 168FDC433EF for ; Fri, 15 Apr 2022 16:53:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355988AbiDOQ4X (ORCPT ); Fri, 15 Apr 2022 12:56:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355982AbiDOQ4V (ORCPT ); Fri, 15 Apr 2022 12:56:21 -0400 Received: from olfflo.fourcot.fr (fourcot.fr [217.70.191.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A78BB972A2 for ; Fri, 15 Apr 2022 09:53:52 -0700 (PDT) From: Florent Fourcot To: netdev@vger.kernel.org Cc: cong.wang@bytedance.com, edumazet@google.com, Florent Fourcot , Jiri Pirko , Brian Baboch Subject: [PATCH v5 net-next 3/4] rtnetlink: return ENODEV when IFLA_ALT_IFNAME is used in dellink Date: Fri, 15 Apr 2022 18:53:29 +0200 Message-Id: <20220415165330.10497-4-florent.fourcot@wifirst.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220415165330.10497-1-florent.fourcot@wifirst.fr> References: <20220415165330.10497-1-florent.fourcot@wifirst.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If IFLA_ALT_IFNAME is set and given interface is not found, we should return ENODEV and be consistent with IFLA_IFNAME behaviour This commit extends feature of commit 76c9ac0ee878, "net: rtnetlink: add possibility to use alternative names as message handle" CC: Jiri Pirko Signed-off-by: Florent Fourcot Signed-off-by: Brian Baboch --- net/core/rtnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 5899b1d2de14..73f2cbc440c9 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -3158,7 +3158,7 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, goto out; if (!dev) { - if (tb[IFLA_IFNAME] || ifm->ifi_index > 0) + if (tb[IFLA_IFNAME] || tb[IFLA_ALT_IFNAME] || ifm->ifi_index > 0) err = -ENODEV; goto out;