From patchwork Fri Apr 15 16:53:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Fourcot X-Patchwork-Id: 12815201 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 018A5C433F5 for ; Fri, 15 Apr 2022 16:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355986AbiDOQ4V (ORCPT ); Fri, 15 Apr 2022 12:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234466AbiDOQ4T (ORCPT ); Fri, 15 Apr 2022 12:56:19 -0400 Received: from olfflo.fourcot.fr (fourcot.fr [217.70.191.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FF3197297 for ; Fri, 15 Apr 2022 09:53:50 -0700 (PDT) From: Florent Fourcot To: netdev@vger.kernel.org Cc: cong.wang@bytedance.com, edumazet@google.com, Florent Fourcot Subject: [PATCH v5 net-next 0/4] rtnetlink: improve ALT_IFNAME config and fix dangerous GROUP usage Date: Fri, 15 Apr 2022 18:53:26 +0200 Message-Id: <20220415165330.10497-1-florent.fourcot@wifirst.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org First commit forbids dangerous calls when both IFNAME and GROUP are given, since it can introduce unexpected behaviour when IFNAME does not match any interface. Second patch achieves primary goal of this patchset to fix/improve IFLA_ALT_IFNAME attribute, since previous code was never working for newlink/setlink. ip-link command is probably getting interface index before, and was not using this feature. Last two patches are improving error code on corner cases. Changes in v2: * Remove ifname argument in rtnl_dev_get/do_setlink functions (simplify code) * Use a boolean to avoid condition duplication in __rtnl_newlink Changes in v3: * Simplify rtnl_dev_get signature Changes in v4: * Rename link_lookup to link_specified Changes in v5: * Re-order patches Florent Fourcot (4): rtnetlink: return ENODEV when ifname does not exist and group is given rtnetlink: enable alt_ifname for setlink/newlink rtnetlink: return ENODEV when IFLA_ALT_IFNAME is used in dellink rtnetlink: return EINVAL when request cannot succeed net/core/rtnetlink.c | 91 ++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 46 deletions(-) Reviewed-by: Jakub Kicinski