From nobody Sat Jan 11 12:35:50 2025 X-Original-To: dev-commits-src-all@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 4YVdKf5pD2z5kClt; Sat, 11 Jan 2025 12:35:50 +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 4YVdKf55Wbz4N7R; Sat, 11 Jan 2025 12:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736598950; 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=5vlPvyQdqVHJxyZO+xGFkpnFmrsBRYmd4XLVpDlwKd8=; b=kqVd45vNRPEcV+MD+zERWulL3pyrUperSRgg3CXCNcyA4z8fYzQhnIk6wPq2MNdTcGvAQ9 c/sU2AoB6HzLaHDcQpyMvUJ05FH63MBzXBLWUhB7+bkjGcBGFWjwtavgB0u0I9ssFgXOs7 R0kyB//ETYuZfDWiq7pkd7paDtyyc51Y7Qsn2GxS5n13qcEEr+2Ag8D9MQMa9kh0Slv8nW cHVnxwo1pwGOMHinWYtTIu+LsiP+UOCsdD9LTZX3vkCzXZbFg4M3svvQng4+WcUoGHhvMc x5a0WaflwHdVzX0MFclgIUAKMtq8nF3oyPSDNT5wlA33hL1iSs0ncPODKjXKlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736598950; 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=5vlPvyQdqVHJxyZO+xGFkpnFmrsBRYmd4XLVpDlwKd8=; b=AY4JLPoP1Vj3Gq33lFrv9Kvelkw6UfRhUaJBJCyp7qS/RyOSYnfee9rMG2Bqs65GNv3JF3 b2UgglMM+Y4XBfdDH+ODu6D1nik2TU79IKrQUskDa+5Bo2gNg5rObcfzxGg5u4ss8TjkrY qQNd0DuJwaOZo4+neeT1QTpDrQBc8u8Bt/tc6Jx4xrvGnKX8MUil9Zenfzevx4xsfpG3tE jcLLq8MDQr89IT98UAY4BqMnzAMLT+PjIfpa8RtG45+TY1CHX9W8qTiehdEon4kpq89kv0 lT/Z/wV8hG5IjCILCJSVw9Cs9RnP1BYL1iE2WX9UEZzhLm2J/dhlL+W+yKxZfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736598950; a=rsa-sha256; cv=none; b=TntqszvrjnjdjEnPenPgyfyoLKON+fLALQiGSBNXjwBQ4DCe8jk7kJQIOAdPpYX01234y3 VIVFCUrsFYAM0dRMMmD1ReBUd2aeA6QVTgNz5Q3i30+lthw9L1Jh0JLOqeAC4iRWLfxgdV BiAO6TyI9ZqUf2FJR/qGcSrsT9kEmtwQY/vhBp/GUYdqIyqPVzsMM98i3E/OsgOZCVtCgE WkZZt+2hU4jTiFQwW7kHg52kA3CmcXNJ+kOZAwXo6v3xTM+sN4BzXj4w0ot4SXAEIPuC1O qzOfTueECDlW/BJCy+rkwcYpGUog1JFqymO8MWVXfVpH+OdVabxFaHu3x8K41A== 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 4YVdKf4gjvzxwC; Sat, 11 Jan 2025 12:35:50 +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 50BCZosE073563; Sat, 11 Jan 2025 12:35:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50BCZoht073560; Sat, 11 Jan 2025 12:35:50 GMT (envelope-from git) Date: Sat, 11 Jan 2025 12:35:50 GMT Message-Id: <202501111235.50BCZoht073560@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: f57df4589d3c - stable/13 - Fix failure to add an interface prefix route when route with the same prefix is already presented in the routing table. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/13 X-Git-Reftype: branch X-Git-Commit: f57df4589d3cd91dac88b2c9edb80ad0eb50979c Auto-Submitted: auto-generated The branch stable/13 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=f57df4589d3cd91dac88b2c9edb80ad0eb50979c commit f57df4589d3cd91dac88b2c9edb80ad0eb50979c Author: Alexander V. Chernikov AuthorDate: 2024-11-12 23:36:50 +0000 Commit: Eugene Grosbein CommitDate: 2025-01-11 12:34:48 +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 75e4be5e9a5c..fd09998d4a01 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -757,12 +757,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 8591f36fbbe1..aea7d2d04a0d 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -59,11 +59,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);