summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-09-16 17:44:37 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-09-16 17:44:37 +0000
commitefa48c743d42e62992290a70cac6934c7ff421b1 (patch)
treed233a4d47a1c4d63751679a44d00b2eb81e007ee
parentecba5c786e44e6efc1fcc79d17327c21aa4b1c8d (diff)
when a cloned peer goes back to IDLE state, don't remove him immediately
but keep him around for some more time (an hour here). fixes an issue Arvid was reporting: when a cloned neighbor rejects our OPEN message due to capability negotiation (or missing implementation of those), we set a marker and retry without. However, if we remove the peer immediately, it gets freshly cloned on the next trial, with default settings, thus including capability negotiation, and thus failes again. this will also help with route flap dampening. ok claudio
-rw-r--r--usr.sbin/bgpd/session.c12
-rw-r--r--usr.sbin/bgpd/session.h3
2 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 15cf0e7d94e..ba6fe7d2865 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.191 2004/09/16 17:36:29 henning Exp $ */
+/* $OpenBSD: session.c,v 1.192 2004/09/16 17:44:36 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -264,6 +264,12 @@ session_main(struct bgpd_config *config, struct peer *cpeers,
for (p = peers; p != NULL; p = next) {
next = p->next;
if (!pending_reconf) {
+ /* cloned peer that idled out? */
+ if (p->state == STATE_IDLE && p->conf.cloned &&
+ time(NULL) - p->stats.last_updown >=
+ INTERVAL_HOLD_CLONED)
+ p->conf.reconf_action = RECONF_DELETE;
+
/* new peer that needs init? */
if (p->state == STATE_NONE)
init_peer(p);
@@ -838,14 +844,12 @@ change_state(struct peer *peer, enum session_state state,
peer->rbuf = NULL;
if (peer->state == STATE_ESTABLISHED)
session_down(peer);
- if (event != EVNT_STOP && !peer->conf.cloned) {
+ if (event != EVNT_STOP) {
peer->IdleHoldTimer = time(NULL) + peer->IdleHoldTime;
if (event != EVNT_NONE &&
peer->IdleHoldTime < MAX_IDLE_HOLD/2)
peer->IdleHoldTime *= 2;
}
- if (peer->state != STATE_NONE && peer->conf.cloned)
- peer->conf.reconf_action = RECONF_DELETE;
break;
case STATE_CONNECT:
break;
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 259ecc238d7..1c09825b64f 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.61 2004/08/06 11:51:19 claudio Exp $ */
+/* $OpenBSD: session.h,v 1.62 2004/09/16 17:44:36 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -25,6 +25,7 @@
#define INTERVAL_HOLD_INITIAL 240
#define INTERVAL_HOLD 90
#define INTERVAL_IDLE_HOLD_INITIAL 30
+#define INTERVAL_HOLD_CLONED 3600
#define MAX_IDLE_HOLD 3600
#define MSGSIZE_HEADER 19
#define MSGSIZE_HEADER_MARKER 16