diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2009-05-27 04:18:22 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2009-05-27 04:18:22 +0000 |
commit | 3eb9a9accd3bed654877fd29df9d6670155d6e12 (patch) | |
tree | 80a9241dd0e908df8c37130a4c54d1058a64753b /usr.sbin/bgpd | |
parent | c23c6b7fedb59701ef012486e8efb29bf9d207f1 (diff) |
add an option to change the "connect-retry" timer which defaults to 120s.
this can be used to decrease the failover time in specific carp'ed
IBGP setups.
ok henning@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/bgpd.conf.5 | 9 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/parse.y | 12 | ||||
-rw-r--r-- | usr.sbin/bgpd/printconf.c | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 14 |
5 files changed, 30 insertions, 12 deletions
diff --git a/usr.sbin/bgpd/bgpd.conf.5 b/usr.sbin/bgpd/bgpd.conf.5 index d3c8e207c40..cf9b972ffe0 100644 --- a/usr.sbin/bgpd/bgpd.conf.5 +++ b/usr.sbin/bgpd/bgpd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgpd.conf.5,v 1.91 2009/03/22 22:34:59 henning Exp $ +.\" $OpenBSD: bgpd.conf.5,v 1.92 2009/05/27 04:18:21 reyk Exp $ .\" .\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> .\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -16,7 +16,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 22 2009 $ +.Dd $Mdocdate: May 27 2009 $ .Dt BGPD.CONF 5 .Os .Sh NAME @@ -129,6 +129,11 @@ For example: AS 3.10 .Ed .Pp +.It Ic connect-retry Ar seconds +Set the number of seconds before retrying to open a connection. +This timer should be sufficiently large in EBGP configurations. +The default is 120 seconds. +.Pp .It Xo .Ic dump .Pq Ic table Ns \&| Ns Ic table-mp diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 89613af46cf..cac9fc9aa8c 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.231 2009/05/17 12:25:15 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.232 2009/05/27 04:18:21 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -172,6 +172,7 @@ struct bgpd_config { u_int16_t short_as; u_int16_t holdtime; u_int16_t min_holdtime; + u_int16_t connectretry; }; struct buf_read { diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 54851ca8269..5e72b794674 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.224 2009/04/23 16:20:39 sthen Exp $ */ +/* $OpenBSD: parse.y,v 1.225 2009/05/27 04:18:21 reyk Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -158,7 +158,7 @@ typedef struct { %token RDE EVALUATE IGNORE COMPARE %token GROUP NEIGHBOR NETWORK %token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX RESTART -%token ANNOUNCE DEMOTE +%token ANNOUNCE DEMOTE CONNECTRETRY %token ENFORCE NEIGHBORAS CAPABILITIES REFLECTOR DEPEND DOWN SOFTRECONFIG %token DUMP IN OUT %token LOG ROUTECOLL TRANSPARENT @@ -529,6 +529,13 @@ conf_main : AS as4number { } conf->rtableid = $2; } + | CONNECTRETRY NUMBER { + if ($2 > USHRT_MAX || $2 < 1) { + yyerror("invalid connect-retry"); + YYERROR; + } + conf->connectretry = $2; + } ; mrtdump : DUMP STRING inout STRING optnumber { @@ -1777,6 +1784,7 @@ lookup(char *s) { "capabilities", CAPABILITIES}, { "community", COMMUNITY}, { "compare", COMPARE}, + { "connect-retry", CONNECTRETRY}, { "connected", CONNECTED}, { "delete", DELETE}, { "demote", DEMOTE}, diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c index 1f311f5201b..2bef2b187fa 100644 --- a/usr.sbin/bgpd/printconf.c +++ b/usr.sbin/bgpd/printconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printconf.c,v 1.67 2009/03/26 13:59:30 henning Exp $ */ +/* $OpenBSD: printconf.c,v 1.68 2009/05/27 04:18:21 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -185,6 +185,8 @@ print_mainconf(struct bgpd_config *conf) printf("holdtime %u\n", conf->holdtime); if (conf->min_holdtime) printf("holdtime min %u\n", conf->min_holdtime); + if (conf->connectretry) + printf("connect-retry %u\n", conf->connectretry); if (conf->flags & BGPD_FLAG_NO_FIB_UPDATE) printf("fib-update no\n"); diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index fdeb2111e20..42c5dffbf95 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.289 2009/03/19 07:00:07 claudio Exp $ */ +/* $OpenBSD: session.c,v 1.290 2009/05/27 04:18:21 reyk Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -589,6 +589,8 @@ init_conf(struct bgpd_config *c) { if (!c->holdtime) c->holdtime = INTERVAL_HOLD; + if (!c->connectretry) + c->connectretry = INTERVAL_CONNECTRETRY; } void @@ -663,7 +665,7 @@ bgp_fsm(struct peer *peer, enum session_events event) } else { change_state(peer, STATE_CONNECT, event); timer_set(peer, Timer_ConnectRetry, - INTERVAL_CONNECTRETRY); + conf->connectretry); session_connect(peer); } peer->passive = 0; @@ -688,13 +690,13 @@ bgp_fsm(struct peer *peer, enum session_events event) break; case EVNT_CON_OPENFAIL: timer_set(peer, Timer_ConnectRetry, - INTERVAL_CONNECTRETRY); + conf->connectretry); session_close_connection(peer); change_state(peer, STATE_ACTIVE, event); break; case EVNT_TIMER_CONNRETRY: timer_set(peer, Timer_ConnectRetry, - INTERVAL_CONNECTRETRY); + conf->connectretry); session_connect(peer); break; default: @@ -717,7 +719,7 @@ bgp_fsm(struct peer *peer, enum session_events event) break; case EVNT_CON_OPENFAIL: timer_set(peer, Timer_ConnectRetry, - INTERVAL_CONNECTRETRY); + conf->connectretry); session_close_connection(peer); change_state(peer, STATE_ACTIVE, event); break; @@ -744,7 +746,7 @@ bgp_fsm(struct peer *peer, enum session_events event) case EVNT_CON_CLOSED: session_close_connection(peer); timer_set(peer, Timer_ConnectRetry, - INTERVAL_CONNECTRETRY); + conf->connectretry); change_state(peer, STATE_ACTIVE, event); break; case EVNT_CON_FATAL: |