From cf0673b961b17de5d245b49b81f9f40ddf3f7263 Mon Sep 17 00:00:00 2001 From: benno Date: Tue, 10 Jul 2018 12:40:41 +0000 Subject: [PATCH] You can run multiple copies of bgpd in seperate rdomains. However, the processes will see each others route messages. Some structures are not initialized correctly for that, causing at least useless log messages. This is an attempt to use the default_tableid where its needed. A few hardcoded uses of rtable 0 remain. ok claudio@ --- usr.sbin/bgpd/bgpd.c | 4 ++-- usr.sbin/bgpd/bgpd.h | 4 ++-- usr.sbin/bgpd/parse.y | 11 ++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 44ba0708b62..03dec715288 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.192 2018/02/10 01:24:28 benno Exp $ */ +/* $OpenBSD: bgpd.c,v 1.193 2018/07/10 12:40:41 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -500,7 +500,7 @@ reconfigure(char *conffile, struct bgpd_config *conf, struct peer **peer_l) } /* networks go via kroute to the RDE */ - if (kr_net_reload(0, &conf->networks)) + if (kr_net_reload(conf->default_tableid, &conf->networks)) return (-1); /* prefixsets for filters in the RDE */ diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 01eee6b7498..f18dcf4d82f 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.320 2018/06/29 11:45:50 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.321 2018/07/10 12:40:41 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -340,7 +340,7 @@ struct peer_config { #define PEERFLAG_LOG_UPDATES 0x02 enum network_type { - NETWORK_DEFAULT, + NETWORK_DEFAULT, /* from network statements */ NETWORK_STATIC, NETWORK_CONNECTED, NETWORK_RTLABEL, diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 2b845b55092..2257473f7ce 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.326 2018/07/10 09:55:14 benno Exp $ */ +/* $OpenBSD: parse.y,v 1.327 2018/07/10 12:40:41 benno Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -2994,9 +2994,10 @@ parse_config(char *filename, struct bgpd_config *xconf, struct peer **xpeers) netconf = &conf->networks; - /* the Adj-RIB-In/Out have no fib so no need to set the tableid */ - add_rib("Adj-RIB-In", 0, F_RIB_NOFIB | F_RIB_NOEVALUATE); - add_rib("Adj-RIB-Out", 0, F_RIB_NOFIB | F_RIB_NOEVALUATE); + add_rib("Adj-RIB-In", conf->default_tableid, + F_RIB_NOFIB | F_RIB_NOEVALUATE); + add_rib("Adj-RIB-Out", conf->default_tableid, + F_RIB_NOFIB | F_RIB_NOEVALUATE); add_rib("Loc-RIB", conf->default_tableid, F_RIB_LOCAL); if ((file = pushfile(filename, 1)) == NULL) { @@ -3586,8 +3587,8 @@ add_rib(char *name, u_int rtableid, u_int16_t flags) free(rr); return (-1); } - rr->rtableid = rtableid; } + rr->rtableid = rtableid; SIMPLEQ_INSERT_TAIL(&ribnames, rr, entry); return (0); } -- 2.20.1