summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-09-08 10:46:41 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-09-08 10:46:41 +0000
commitb8e5e021299a88f2cd4b6cde58cac13c02815ee6 (patch)
tree539b272edde417ed1ae2b208b48c0132febfd345
parent79452849f82a8546be085ead11cf29040d5f8bf5 (diff)
fix reloads where capbilities change
when a new peer in initialized, the configured capailities are copied. this copy is modified as part of the capabilities negotiation. now if teh session drops we want to re-negotiate capabilities at the next establishment, last not least because the configured capabilities might have changed in between (that's how I stumbled over it, added v6 shitz) so copy the configured capabilities over every time a session goes to IDLE state, unless the reason is EVNT_RCVD_OPEN, because then we're in capabilities negotiation.
-rw-r--r--usr.sbin/bgpd/session.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 108865abe28..c6fdc57e90c 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.232 2005/07/24 11:56:37 henning Exp $ */
+/* $OpenBSD: session.c,v 1.233 2005/09/08 10:46:40 henning Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -531,10 +531,6 @@ init_peer(struct peer *p)
{
p->fd = p->wbuf.fd = -1;
- memcpy(&p->capa.ann, &p->conf.capabilities, sizeof(p->capa.ann));
- if (!p->conf.announce_capa)
- session_capa_ann_none(p);
-
if (p->conf.if_depend[0])
imsg_compose(ibuf_main, IMSG_IFINFO, 0, 0, -1,
p->conf.if_depend, sizeof(p->conf.if_depend));
@@ -857,6 +853,13 @@ change_state(struct peer *peer, enum session_state state,
peer->IdleHoldTime < MAX_IDLE_HOLD/2)
peer->IdleHoldTime *= 2;
}
+ if (event != EVNT_RCVD_OPEN) { /* capa negotiation */
+ /* initialize capability negotiation structures */
+ memcpy(&peer->capa.ann, &peer->conf.capabilities,
+ sizeof(peer->capa.ann));
+ if (!peer->conf.announce_capa)
+ session_capa_ann_none(peer);
+ }
break;
case STATE_CONNECT:
break;