summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/session.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2021-05-06 09:18:55 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2021-05-06 09:18:55 +0000
commitd9e3edf3284c0cf0c030d40dba8f51d8893308b9 (patch)
tree9395e4fe48120da57f4082f15b33bcddbbf05806 /usr.sbin/bgpd/session.c
parent16b333ca38dfeababbaaac8f2a87f1fd41131ade (diff)
Improve reload behaviour of RDE peer flags and export_type.
Add an extra reload barrier (IMSG_RECONF_DRAIN) to the sync of the peer config from the session engine to the rde. Necessary to ensure that the peer config is up to date in the RDE before hitting reconfiguration. Store the export_type and the peer flags outside of peer->conf. Adjust all users of these two fields so they only look at the copies in peer. During reload check the values with the peer->conf to check for changes. If the export_type or the rde evaluate or transparent-as flags changed flush the Adj-RIB-Out for that peer and in a 2nd step rebuild the RIB from scratch. This results in a lot of UPDATE churn but these configs are not altered often. Fix multiple issues in the rde_softreconfig_in_done handler that resulted in multiple runs of the out stage of the softreconfig pipeline. OK benno@
Diffstat (limited to 'usr.sbin/bgpd/session.c')
-rw-r--r--usr.sbin/bgpd/session.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index e2649432b9b..b8b6b6dc11b 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.413 2021/05/03 14:08:09 claudio Exp $ */
+/* $OpenBSD: session.c,v 1.414 2021/05/06 09:18:54 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -2734,10 +2734,24 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx, u_int *listener_cnt)
}
break;
case IMSG_RECONF_DRAIN:
- if (idx != PFD_PIPE_MAIN)
- fatalx("reconf request not from parent");
- imsg_compose(ibuf_main, IMSG_RECONF_DRAIN, 0, 0,
- -1, NULL, 0);
+ switch (idx) {
+ case PFD_PIPE_ROUTE:
+ if (nconf != NULL)
+ fatalx("got unexpected %s from RDE",
+ "IMSG_RECONF_DONE");
+ imsg_compose(ibuf_main, IMSG_RECONF_DONE, 0, 0,
+ -1, NULL, 0);
+ break;
+ case PFD_PIPE_MAIN:
+ if (nconf == NULL)
+ fatalx("got unexpected %s from parent",
+ "IMSG_RECONF_DONE");
+ imsg_compose(ibuf_main, IMSG_RECONF_DRAIN, 0, 0,
+ -1, NULL, 0);
+ break;
+ default:
+ fatalx("reconf request not from parent or RDE");
+ }
break;
case IMSG_RECONF_DONE:
if (idx != PFD_PIPE_MAIN)
@@ -2771,8 +2785,10 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx, u_int *listener_cnt)
nconf = NULL;
pending_reconf = 0;
log_info("SE reconfigured");
- imsg_compose(ibuf_main, IMSG_RECONF_DONE, 0, 0,
- -1, NULL, 0);
+ /*
+ * IMSG_RECONF_DONE is sent when the RDE drained
+ * the peer config sent in merge_peers().
+ */
break;
case IMSG_IFINFO:
if (idx != PFD_PIPE_MAIN)
@@ -3343,6 +3359,9 @@ merge_peers(struct bgpd_config *c, struct bgpd_config *nc)
}
}
+ if (imsg_rde(IMSG_RECONF_DRAIN, 0, NULL, 0) == -1)
+ fatalx("imsg_compose error");
+
/* pfkeys of new peers already loaded by the parent process */
RB_FOREACH_SAFE(np, peer_head, &nc->peers, next) {
RB_REMOVE(peer_head, &nc->peers, np);