diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-18 15:09:32 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-18 15:09:32 +0000 |
commit | 493dd4349dade9d2d80edbdd80b956182ed00c65 (patch) | |
tree | 494930b5216f5f99b1ec2015dc9e3aaa9111956a /usr.sbin | |
parent | b6203992b3d86d20fc47448e0049abfdde167bfb (diff) |
when we are in state CONNECT, i. e. we have a half-open tcp connection
to the peer, and we get a connection from exactly that peer, we used to
refuse it (because we already had a - tho only half-open - connection).
this diff changes that so that the connection request from the neighbor is
preferred in only that specific case, and the existing half-open connection
is teared down. this can speed up session re-establishment quite a bit,
especially with multihop.
claudio ok
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/session.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 8c3db943a14..59b421e19c2 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.137 2004/03/16 12:06:42 henning Exp $ */ +/* $OpenBSD: session.c,v 1.138 2004/03/18 15:09:31 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -770,9 +770,13 @@ session_accept(int listenfd) if (p != NULL && (p->state == STATE_CONNECT || p->state == STATE_ACTIVE)) { if (p->sock != -1) { - shutdown(connfd, SHUT_RDWR); - close(connfd); - return; + if (p->state == STATE_CONNECT) + session_close_connection(p); + else { + shutdown(connfd, SHUT_RDWR); + close(connfd); + return; + } } if (p->conf.tcp_md5_key[0]) { len = sizeof(opt); |