Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
use proper rtable limit in sppp code
To:
tech@openbsd.org
Date:
Tue, 19 Aug 2025 11:02:37 +0200

Download raw body.

Thread
I want to remove most use of RT_TABLEID_MAX (or actually make it a pure
userland thing and allowing it to be much larger).

sppp(4) still uses it in a for loop where most other callers use
rtmap_limit. So this diff does the same as code in route.c.

Now honestly I think sppp(4) should finally grow up and stop doing those
stupid 0.0.0.1 tricks but that is for another day.
-- 
:wq Claudio

Index: net/if_spppsubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_spppsubr.c,v
diff -u -p -r1.197 if_spppsubr.c
--- net/if_spppsubr.c	7 Jul 2025 02:28:50 -0000	1.197
+++ net/if_spppsubr.c	17 Jul 2025 12:41:43 -0000
@@ -63,6 +63,8 @@
 
 #include <net/if_sppp.h>
 
+extern unsigned int	rtmap_limit;
+
 # define UNTIMEOUT(fun, arg, handle)	\
 	timeout_del(&(handle))
 
@@ -4238,7 +4240,7 @@ sppp_update_gw(struct ifnet *ifp)
 	u_int tid;
 
 	/* update routing table */
-	for (tid = 0; tid <= RT_TABLEID_MAX; tid++) {
+	for (tid = 0; tid <= rtmap_limit; tid++) {
 		rtable_walk(tid, AF_INET, NULL, sppp_update_gw_walker, ifp);
 	}
 }