git: 439d087d0b55 - main - [fib algo] always commit static routes synchronously.

Alexander V. Chernikov melifaro at FreeBSD.org
Tue Apr 27 08:33:10 UTC 2021


The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=439d087d0b55574db81f4a2799a411c1236d95e3

commit 439d087d0b55574db81f4a2799a411c1236d95e3
Author:     Alexander V. Chernikov <melifaro at FreeBSD.org>
AuthorDate: 2021-04-27 08:23:29 +0000
Commit:     Alexander V. Chernikov <melifaro at FreeBSD.org>
CommitDate: 2021-04-27 08:31:40 +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
---
 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;
 	}
 


More information about the dev-commits-src-all mailing list