summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2004-09-22 08:46:28 +0000
committerhenning <henning@openbsd.org>2004-09-22 08:46:28 +0000
commit018b273250404a2eee5ac0f100b0c8d0424d54f3 (patch)
tree41c88ff320cdf94c4eb255a9701b355b92c708be
parentOn single SCSI slot O2's the first disk is numbered 2 (the slot number) (diff)
downloadwireguard-openbsd-018b273250404a2eee5ac0f100b0c8d0424d54f3.tar.xz
wireguard-openbsd-018b273250404a2eee5ac0f100b0c8d0424d54f3.zip
don't bother shrinking the pfd and index2peer arrays
ok claudio
-rw-r--r--usr.sbin/bgpd/session.c36
-rw-r--r--usr.sbin/bgpd/session.h6
2 files changed, 16 insertions, 26 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index ba6fe7d2865..1c383e21ef9 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.192 2004/09/16 17:44:36 henning Exp $ */
+/* $OpenBSD: session.c,v 1.193 2004/09/22 08:46:28 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -16,7 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-
#include <sys/param.h>
#include <sys/types.h>
@@ -297,54 +296,47 @@ session_main(struct bgpd_config *config, struct peer *cpeers,
last = p;
}
- if (peer_cnt > peer_l_elms ||
- peer_cnt + 2 * PEER_L_RESERVE < peer_l_elms) {
+ if (peer_cnt > peer_l_elms) {
if ((newp = realloc(peer_l, sizeof(struct peer *) *
- (peer_cnt + PEER_L_RESERVE))) == NULL) {
+ peer_cnt)) == NULL) {
/* panic for now */
log_warn("could not resize peer_l from %u -> %u"
- " entries", peer_l_elms,
- peer_cnt + PEER_L_RESERVE);
+ " entries", peer_l_elms, peer_cnt);
fatalx("exiting");
}
peer_l = newp;
- peer_l_elms = peer_cnt + PEER_L_RESERVE;
+ peer_l_elms = peer_cnt;
}
mrt_cnt = 0;
- LIST_FOREACH(m, &mrthead, entry) {
+ LIST_FOREACH(m, &mrthead, entry)
if (m->queued)
mrt_cnt++;
- }
- if (mrt_cnt > mrt_l_elms ||
- mrt_cnt + 2 * PEER_L_RESERVE < mrt_l_elms) {
+ if (mrt_cnt > mrt_l_elms) {
if ((newp = realloc(mrt_l, sizeof(struct mrt *) *
- (mrt_cnt + PEER_L_RESERVE))) == NULL) {
+ mrt_cnt)) == NULL) {
/* panic for now */
log_warn("could not resize mrt_l from %u -> %u"
- " entries", mrt_l_elms,
- mrt_cnt + PEER_L_RESERVE);
+ " entries", mrt_l_elms, mrt_cnt);
fatalx("exiting");
}
mrt_l = newp;
- mrt_l_elms = mrt_cnt + PEER_L_RESERVE;
+ mrt_l_elms = mrt_cnt;
}
new_cnt = PFD_LISTENERS_START + listener_cnt + peer_cnt +
ctl_cnt + mrt_cnt;
- if (new_cnt > pfd_elms ||
- (new_cnt + 2) * PFD_RESERVE < pfd_elms) {
+ if (new_cnt > pfd_elms) {
if ((newp = realloc(pfd, sizeof(struct pollfd) *
- (new_cnt + PFD_RESERVE))) == NULL) {
+ new_cnt)) == NULL) {
/* panic for now */
log_warn("could not resize pfd from %u -> %u"
- " entries", pfd_elms,
- new_cnt + PFD_RESERVE);
+ " entries", pfd_elms, new_cnt);
fatalx("exiting");
}
pfd = newp;
- pfd_elms = new_cnt + PFD_RESERVE;
+ pfd_elms = new_cnt;
}
bzero(pfd, sizeof(struct pollfd) * pfd_elms);
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 1c09825b64f..fbfcdd2af60 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.62 2004/09/16 17:44:36 henning Exp $ */
+/* $OpenBSD: session.h,v 1.63 2004/09/22 08:46:28 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -33,9 +33,7 @@
#define MSGSIZE_OPEN_MIN 29
#define MSGSIZE_UPDATE_MIN 23
#define MSGSIZE_KEEPALIVE MSGSIZE_HEADER
-#define MSGSIZE_RREFRESH MSGSIZE_HEADER + 4
-#define PFD_RESERVE 5
-#define PEER_L_RESERVE 2
+#define MSGSIZE_RREFRESH MSGSIZE_HEADER + 4
enum session_state {
STATE_NONE,