From nobody Sat Jan 11 12:27:47 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YVd8M54n9z5kCTp; Sat, 11 Jan 2025 12:27:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YVd8M4Y03z4MnZ; Sat, 11 Jan 2025 12:27:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736598467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Fk0+sKs4JWW9r8kuoYTdswod1S9U5c1GkrZrdyeQKTk=; b=RTeBV89gPprsV9U1NByYN3+y2A4WurtE0BQkb56j+sDbQPiSCDZojOhsT5hOc6wElR4u7h j7HjVcdVpIUeHs0vLMdZWylbfKh4J5YXSdRD39ajIYDDqDpOH7k1meSPN8x7S3oeisKDsb X7Int9ScVyWucMzZ7hAqmi5K1Dfuq9Pv9a+p4uJNvRfuqS9B+Uyc9tOf8TaX4oxbn/Epeo zHRziRh5PNFOQ8UogAc+We0qTGYzhOUZWlEDVHGM51XVwjT2zmCa6q17aeTg2outPbw7+H oAHW+sTl+cXH4KDYfRQg0EJb528GUnkfw+NJVizkMjMMQzbcDV22YB5DHdlpAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736598467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Fk0+sKs4JWW9r8kuoYTdswod1S9U5c1GkrZrdyeQKTk=; b=kiZJpEaNdyqxdPLXm2phyQcsezBu64fC3JwJIvhR7XwmVc+4Rhldw8AEEkWUl4qV4tzzh7 9SrTTw6N9qnHaYzix9W0IA4jsQPbbl6hh0kWspDS/1efug9u9jqjiQbc6DfWmJxzVAHMad sYYuQGA/CtTJKYCgmpQZmLbECwVQFkv+EvtxR70NVvbqN2QCBdFuzFg13yBCKpjuOCPNDu JGg3ViR4Fb/wKLyoWKEW93UnACVpa4uTwFlPa2aDTC71gV7HFlvTobJMbNVirM59psiy97 q8/nkacw6ZZ7A+FIe1Z4JZVzXvzncPSWcLprsIYyiBDH9T2AQgEhjFNzkFb4bQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736598467; a=rsa-sha256; cv=none; b=pAVr9sOjJy2DRsaFYWF+bMu+L3yDwk54drNXboSZOEPivBFsKfni9PK7X1yEMik8XCPx8P Qwi/Xyk4VrKxwXLxFdOwkJzYetbd3FspazrLD/kKiozPBvgOGyrGrVw97laRg4kHmLdW6V o465nFa72ta24s074KLTmDXlbUiL8/hiG5r2c9yxsiGgVKTxg83C+M8oXDjWCAmrsfGqoS xBajk/YAUZhPSvzlWaZxjwSklEQVvkviUyf4f58ozIMwJ/BIhc/M8jX2a/NaFZiCMLZgdK AWbC86SFBfpbW0noNCIN4IovWjI0eFvw06aXw0ROpO9IZ0Ts+8Objpax5NkJEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YVd8M3p5XzyWc; Sat, 11 Jan 2025 12:27:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50BCRlDE055629; Sat, 11 Jan 2025 12:27:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50BCRlog055626; Sat, 11 Jan 2025 12:27:47 GMT (envelope-from git) Date: Sat, 11 Jan 2025 12:27:47 GMT Message-Id: <202501111227.50BCRlog055626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: d62b2d8f3a47 - stable/14 - Fix failure to add an interface prefix route when route with the same prefix is already presented in the routing table. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d62b2d8f3a4711724d984102daa0bd0a5351f8b9 Auto-Submitted: auto-generated The branch stable/14 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=d62b2d8f3a4711724d984102daa0bd0a5351f8b9 commit d62b2d8f3a4711724d984102daa0bd0a5351f8b9 Author: Alexander V. Chernikov AuthorDate: 2024-11-12 23:36:50 +0000 Commit: Eugene Grosbein CommitDate: 2025-01-11 12:25:16 +0000 Fix failure to add an interface prefix route when route with the same prefix is already presented in the routing table. PR: 277125 Reported by: Oleksandr Ignatyev Reviewed by: ae, jlduran Tested by: jlduran Differential Revision: https://reviews.freebsd.org/D47534 (cherry picked from commit 1da4954c92ea7585b352ba830d3ee64ca69ada52) --- sys/net/route/route_ctl.c | 13 ++++++++----- sys/net/route/route_ctl.h | 10 +++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index a07a58737c1c..d7756f2a0eb6 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -772,12 +772,15 @@ add_route_byinfo(struct rib_head *rnh, struct rt_addrinfo *info, rnd_add.rnd_weight = get_info_weight(info, RT_DEFAULT_WEIGHT); int op_flags = RTM_F_CREATE; - if (get_prio_from_info(info) == NH_PRIORITY_HIGH) - op_flags |= RTM_F_FORCE; - else - op_flags |= RTM_F_APPEND; - return (add_route_flags(rnh, rt, &rnd_add, op_flags, rc)); + /* + * Set the desired action when the route already exists: + * If RTF_PINNED is present, assume the direct kernel routes that cannot be multipath. + * Otherwise, append the path. + */ + op_flags |= (info->rti_flags & RTF_PINNED) ? RTM_F_REPLACE : RTM_F_APPEND; + + return (add_route_flags(rnh, rt, &rnd_add, op_flags, rc)); } static int diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index 140f14aa9e4f..845df8ce1fbe 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -61,11 +61,11 @@ int rib_del_route_px_gw(uint32_t fibnum, struct sockaddr *dst, int plen, const struct sockaddr *gw, int op_flags, struct rib_cmd_info *rc); /* operation flags */ -#define RTM_F_CREATE 0x01 -#define RTM_F_EXCL 0x02 -#define RTM_F_REPLACE 0x04 -#define RTM_F_APPEND 0x08 -#define RTM_F_FORCE 0x10 +#define RTM_F_CREATE 0x01 /* Create object if not exists */ +#define RTM_F_EXCL 0x02 /* (Deprecated) Do not replace or append if exists */ +#define RTM_F_REPLACE 0x04 /* Replace if route (even multipath) if exists */ +#define RTM_F_APPEND 0x08 /* Append path to the route */ +#define RTM_F_FORCE 0x10 /* Bump operation priority to highest */ int rib_add_route(uint32_t fibnum, struct rt_addrinfo *info, struct rib_cmd_info *rc);