diff options
author | 2018-10-22 07:46:55 +0000 | |
---|---|---|
committer | 2018-10-22 07:46:55 +0000 | |
commit | cd619dff8e27c038cde6e21a1160d926c50cbe1d (patch) | |
tree | 3ac1c4a918e8d3bdfac66b8b65497757ad98dc92 | |
parent | Make host_*() AF-agnostic (diff) | |
download | wireguard-openbsd-cd619dff8e27c038cde6e21a1160d926c50cbe1d.tar.xz wireguard-openbsd-cd619dff8e27c038cde6e21a1160d926c50cbe1d.zip |
Properly throttle dumping of prefixes to peers. Eventhough we got the XON/XOFF
messages the RDE did not act based on them. This mostly ensures that large
UPDATE runs (e.g. on peer up) are not flodding the imsg queue and therfore
delaying other imsgs.
OK denis@ benno@
-rw-r--r-- | usr.sbin/bgpd/rde.c | 19 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 8 |
2 files changed, 18 insertions, 9 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 2bf92b65ecb..786c538d8ed 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.437 2018/10/18 12:19:09 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.438 2018/10/22 07:46:55 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -334,15 +334,16 @@ rde_main(int debug, int verbose) mctx = LIST_NEXT(mctx, entry); } - rde_update_queue_runner(); - for (aid = AID_INET6; aid < AID_MAX; aid++) - rde_update6_queue_runner(aid); + if (ibuf_se && ibuf_se->w.queued < SESS_MSG_HIGH_MARK) { + rde_update_queue_runner(); + for (aid = AID_INET6; aid < AID_MAX; aid++) + rde_update6_queue_runner(aid); + } if (rde_dump_pending() && ibuf_se_ctl && ibuf_se_ctl->w.queued <= 10) rde_dump_runner(); - if (softreconfig) { + if (softreconfig) rde_reload_runner(); - } } /* do not clean up on shutdown on production, it takes ages. */ @@ -2664,6 +2665,8 @@ rde_update_queue_runner(void) continue; if (peer->state != PEER_UP) continue; + if (peer->throttled) + continue; eor = 0; /* first withdraws */ wpos = 2; /* reserve space for the length field */ @@ -2730,6 +2733,8 @@ rde_update6_queue_runner(u_int8_t aid) continue; if (peer->state != PEER_UP) continue; + if (peer->throttled) + continue; len = sizeof(queue_buf) - MSGSIZE_HEADER; b = up_dump_mp_unreach(queue_buf, &len, peer, aid); @@ -2754,6 +2759,8 @@ rde_update6_queue_runner(u_int8_t aid) continue; if (peer->state != PEER_UP) continue; + if (peer->throttled) + continue; len = sizeof(queue_buf) - MSGSIZE_HEADER; r = up_dump_mp_reach(queue_buf, &len, peer, aid); switch (r) { diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index b680a72c869..4ae322b53f9 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.369 2018/09/29 07:58:06 claudio Exp $ */ +/* $OpenBSD: session.c,v 1.370 2018/10/22 07:46:55 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -1382,7 +1382,8 @@ session_sendmsg(struct bgp_msg *msg, struct peer *p) if (!p->throttled && p->wbuf.queued > SESS_MSG_HIGH_MARK) { if (imsg_rde(IMSG_XOFF, p->conf.id, NULL, 0) == -1) log_peer_warn(&p->conf, "imsg_compose XOFF"); - p->throttled = 1; + else + p->throttled = 1; } free(msg); @@ -1773,7 +1774,8 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p) if (p->throttled && p->wbuf.queued < SESS_MSG_LOW_MARK) { if (imsg_rde(IMSG_XON, p->conf.id, NULL, 0) == -1) log_peer_warn(&p->conf, "imsg_compose XON"); - p->throttled = 0; + else + p->throttled = 0; } if (!(pfd->revents & POLLIN)) return (1); |