Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
bgpd: make some CH tables static
To:
tech@openbsd.org
Date:
Tue, 4 Nov 2025 15:12:25 +0100

Download raw body.

Thread
There is no need to define these tables non-static.

-- 
:wq Claudio

Index: rde_attr.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_attr.c,v
diff -u -p -r1.138 rde_attr.c
--- rde_attr.c	29 Oct 2025 10:34:23 -0000	1.138
+++ rde_attr.c	4 Nov 2025 14:07:16 -0000
@@ -80,8 +80,10 @@ attr_calc_hash(uint8_t type, const void 
 	return SipHash24_End(&ctx);
 }
 
-CH_HEAD(attr_tree, attr)        attrtable = CH_INITIALIZER(&attrtable);
+CH_HEAD(attr_tree, attr);
 CH_PROTOTYPE(attr_tree, attr, attr_hash);
+
+static struct attr_tree attrtable = CH_INITIALIZER(&attrtable);
 
 void
 attr_init(void)
Index: rde_community.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_community.c,v
diff -u -p -r1.17 rde_community.c
--- rde_community.c	29 Oct 2025 10:34:23 -0000	1.17
+++ rde_community.c	4 Nov 2025 14:09:05 -0000
@@ -648,9 +648,11 @@ communities_calc_hash(struct rde_communi
 	}
 }
 	
-CH_HEAD(comm_tree, rde_community)	commtable = CH_INITIALIZER(&commtable);
+CH_HEAD(comm_tree, rde_community);
 CH_PROTOTYPE(comm_tree, rde_community, communities_hash);
 CH_GENERATE(comm_tree, rde_community, communities_equal, communities_hash);
+
+static struct comm_tree	commtable = CH_INITIALIZER(&commtable);
 
 void
 communities_init(void)
Index: rde_rib.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v
diff -u -p -r1.273 rde_rib.c
--- rde_rib.c	29 Oct 2025 10:34:23 -0000	1.273
+++ rde_rib.c	4 Nov 2025 14:09:22 -0000
@@ -654,8 +654,10 @@ path_equal(const struct rde_aspath *a, c
 	return (attr_equal(a, b));
 }
 
-CH_HEAD(path_tree, rde_aspath)	pathtable = CH_INITIALIZER(&pathtable);
+CH_HEAD(path_tree, rde_aspath);
 CH_PROTOTYPE(path_tree, rde_aspath, path_hash);
+
+static struct path_tree	pathtable = CH_INITIALIZER(&pathtable);
 
 static inline struct rde_aspath *
 path_ref(struct rde_aspath *asp)