summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.conf.518
-rw-r--r--usr.sbin/bgpd/bgpd.h3
-rw-r--r--usr.sbin/bgpd/parse.y22
-rw-r--r--usr.sbin/bgpd/printconf.c10
-rw-r--r--usr.sbin/bgpd/session.c6
5 files changed, 46 insertions, 13 deletions
diff --git a/usr.sbin/bgpd/bgpd.conf.5 b/usr.sbin/bgpd/bgpd.conf.5
index e6052b6d0f8..6e0aa21b0ef 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.72 2006/06/19 20:51:46 jmc Exp $
+.\" $OpenBSD: bgpd.conf.5,v 1.73 2006/08/04 12:01:48 henning Exp $
.\"
.\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
.\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -596,9 +596,19 @@ is given,
.Xr bgpd 8
binds to this address first.
.Pp
-.It Ic max-prefix Ar number
-Limit the amount of prefixes received.
-No such limit is imposed by default.
+.It Xo
+.Ic max-prefix Ar number
+.Op Ic restart Ar number
+.Xc
+Terminate the session after
+.Ar number
+prefixes have been received
+(no such limit is imposed by default).
+If
+.Ic restart
+is specified, the session will be restarted after
+.Ar number
+minutes.
.Pp
.It Ic multihop Ar hops
Neighbors not in the same AS as the local
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index fddadae0156..f3d83ce7db7 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.204 2006/06/17 14:06:09 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.205 2006/08/04 12:01:48 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -228,6 +228,7 @@ struct peer_config {
enum announce_type announce_type;
enum enforce_as enforce_as;
enum reconf_action reconf_action;
+ u_int16_t max_prefix_restart;
u_int16_t remote_as;
u_int16_t holdtime;
u_int16_t min_holdtime;
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index f163bce7cbd..0225345d5ef 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.191 2006/06/17 14:06:09 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.192 2006/08/04 12:01:48 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -149,7 +149,8 @@ typedef struct {
%token AS ROUTERID HOLDTIME YMIN LISTEN ON FIBUPDATE
%token RDE EVALUATE IGNORE COMPARE
%token GROUP NEIGHBOR NETWORK
-%token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX ANNOUNCE DEMOTE
+%token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX RESTART
+%token ANNOUNCE DEMOTE
%token ENFORCE NEIGHBORAS CAPABILITIES REFLECTOR DEPEND DOWN SOFTRECONFIG
%token DUMP IN OUT
%token LOG ROUTECOLL TRANSPARENT
@@ -167,7 +168,7 @@ typedef struct {
%token QUALIFY VIA
%token <v.string> STRING
%type <v.number> number asnumber optnumber yesno inout espah
-%type <v.number> family
+%type <v.number> family restart
%type <v.string> string
%type <v.addr> address
%type <v.prefix> prefix addrspec
@@ -717,8 +718,9 @@ peeropts : REMOTEAS asnumber {
else
curpeer->conf.enforce_as = ENFORCE_AS_OFF;
}
- | MAXPREFIX number {
+ | MAXPREFIX number restart {
curpeer->conf.max_prefix = $2;
+ curpeer->conf.max_prefix_restart = $3;
}
| TCP MD5SIG PASSWORD string {
if (curpeer->conf.auth.method) {
@@ -935,6 +937,17 @@ peeropts : REMOTEAS asnumber {
}
;
+restart : /* nada */ { $$ = 0; }
+ | RESTART number {
+ if ($2 < 1 || $2 > USHRT_MAX) {
+ yyerror("restart out of range. 1 to %u minutes",
+ USHRT_MAX);
+ YYERROR;
+ }
+ $$ = $2;
+ }
+ ;
+
family : IPV4 { $$ = AFI_IPv4; }
| IPV6 { $$ = AFI_IPv6; }
;
@@ -1624,6 +1637,7 @@ lookup(char *s)
{ "rde", RDE},
{ "reject", REJECT},
{ "remote-as", REMOTEAS},
+ { "restart", RESTART},
{ "route-collector", ROUTECOLL},
{ "route-reflector", REFLECTOR},
{ "router-id", ROUTERID},
diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c
index a662f9be0a5..d945967e23b 100644
--- a/usr.sbin/bgpd/printconf.c
+++ b/usr.sbin/bgpd/printconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printconf.c,v 1.56 2006/05/27 15:37:29 claudio Exp $ */
+/* $OpenBSD: printconf.c,v 1.57 2006/08/04 12:01:48 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -275,8 +275,12 @@ print_peer(struct peer_config *p, struct bgpd_config *conf, const char *c)
printf("%s\tpassive\n", c);
if (p->local_addr.af)
printf("%s\tlocal-address %s\n", c, log_addr(&p->local_addr));
- if (p->max_prefix)
- printf("%s\tmax-prefix %u\n", c, p->max_prefix);
+ if (p->max_prefix) {
+ printf("%s\tmax-prefix %u", c, p->max_prefix);
+ if (p->max_prefix_restart)
+ printf(" restart %u", p->max_prefix_restart);
+ printf("\n");
+ }
if (p->holdtime)
printf("%s\tholdtime %u\n", c, p->holdtime);
if (p->min_holdtime)
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 081f62ca6a5..4d819f53ffa 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.256 2006/07/30 16:27:28 henning Exp $ */
+/* $OpenBSD: session.c,v 1.257 2006/08/04 12:01:48 henning Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -2413,6 +2413,10 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx, u_int *listener_cnt)
switch (subcode) {
case ERR_CEASE_MAX_PREFIX:
bgp_fsm(p, EVNT_STOP);
+ if (p->conf.max_prefix_restart)
+ p->IdleHoldTimer =
+ time(NULL) + 60 *
+ p->conf.max_prefix_restart;
break;
default:
bgp_fsm(p, EVNT_CON_FATAL);