From owner-dev-commits-src-all@freebsd.org Thu Apr 29 09:17:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8541C5FEE5D; Thu, 29 Apr 2021 09:17:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FW8z91KfTz4Tt7; Thu, 29 Apr 2021 09:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 09FFD1AB0F; Thu, 29 Apr 2021 09:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13T9HO4G032760; Thu, 29 Apr 2021 09:17:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13T9HOMW032759; Thu, 29 Apr 2021 09:17:24 GMT (envelope-from git) Date: Thu, 29 Apr 2021 09:17:24 GMT Message-Id: <202104290917.13T9HOMW032759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 59b3b210a69e - stable/13 - [fib algo] always commit static routes synchronously. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 59b3b210a69e5eda9e36aac740c2a8da0bf39409 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2021 09:17:25 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=59b3b210a69e5eda9e36aac740c2a8da0bf39409 commit 59b3b210a69e5eda9e36aac740c2a8da0bf39409 Author: Alexander V. Chernikov AuthorDate: 2021-04-27 08:23:29 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-29 08:47:32 +0000 [fib algo] always commit static routes synchronously. Modular fib lookup framework features logic that allows route update batching for the algorithms that cannot easily apply the routing change without rebuilding. As a result, dataplane lookups may return old data until the the sync takes place. With the default sync timeout of 50ms, it is possible that new binary like ping(8) executed exactly after route(8) will still use the old fib data. To address some aspects of the problem, framework executes all rtable changes without RTF_GATEWAY synchronously. To fix the aforementioned problem, this diff extends sync execution for all RTF_STATIC routes (e.g. ones maintained by route(8). This fixes a bunch of tests in the networking space. Reported by: ci, arichardson MFC after: 2 weeks (cherry picked from commit 439d087d0b55574db81f4a2799a411c1236d95e3) --- sys/net/route/fib_algo.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 5dff2690454d..9fdc80001986 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -667,13 +667,21 @@ need_immediate_sync(struct fib_data *fd, struct rib_cmd_info *rc) switch (rc->rc_cmd) { case RTM_ADD: nh = rc->rc_nh_new; - if (!NH_IS_NHGRP(nh) && (!(nh->nh_flags & NHF_GATEWAY))) - return (true); + if (!NH_IS_NHGRP(nh)) { + if (!(nh->nh_flags & NHF_GATEWAY)) + return (true); + if (nhop_get_rtflags(nh) & RTF_STATIC) + return (true); + } break; case RTM_DELETE: nh = rc->rc_nh_old; - if (!NH_IS_NHGRP(nh) && (!(nh->nh_flags & NHF_GATEWAY))) - return (true); + if (!NH_IS_NHGRP(nh)) { + if (!(nh->nh_flags & NHF_GATEWAY)) + return (true); + if (nhop_get_rtflags(nh) & RTF_STATIC) + return (true); + } break; }