summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-10-19 10:42:07 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-10-19 10:42:07 +0000
commit7a0f69aae4c268d4ace9e43362a87d9de5cecf2a (patch)
tree9d680f8d1dbd369acc31852e026f4618f161053c
parent600c195b61888ec0dd2f50ed8231ac363e97e24c (diff)
new keyword "down" in neighbor spec, when givenm, the session is not
started on bgpd startup but stays in IDLE. requested by claudio
-rw-r--r--usr.sbin/bgpd/bgpd.conf.56
-rw-r--r--usr.sbin/bgpd/bgpd.h3
-rw-r--r--usr.sbin/bgpd/parse.y8
-rw-r--r--usr.sbin/bgpd/session.c7
4 files changed, 18 insertions, 6 deletions
diff --git a/usr.sbin/bgpd/bgpd.conf.5 b/usr.sbin/bgpd/bgpd.conf.5
index 4569138c290..dc5e000ad63 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.60 2005/08/10 09:00:16 jmc Exp $
+.\" $OpenBSD: bgpd.conf.5,v 1.61 2005/10/19 10:42:06 henning Exp $
.\"
.\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
.\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -434,6 +434,10 @@ The description is used when logging neighbor events, in status
reports, for specifying neighbors, etc., but has no further meaning to
.Xr bgpd 8 .
.Pp
+.It Ic down
+Do not start the session when bgpd comes up but stay in
+.Em IDLE .
+.Pp
.It Xo
.Ic dump
.Pq Ic all Ns \&| Ns Ic updates
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 6e8a73f0c49..9a8c09593ea 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.177 2005/09/20 13:31:53 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.178 2005/10/19 10:42:06 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -231,6 +231,7 @@ struct peer_config {
u_int8_t ebgp; /* 1 = ebgp, 0 = ibgp */
u_int8_t distance; /* 1 = direct, >1 = multihop */
u_int8_t passive;
+ u_int8_t down;
u_int8_t announce_capa;
u_int8_t reflector_client;
};
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index adb8f4a1115..ca7e957b41f 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.171 2005/08/09 20:27:25 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.172 2005/10/19 10:42:06 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -145,7 +145,7 @@ typedef struct {
%token RDE EVALUATE IGNORE COMPARE
%token GROUP NEIGHBOR NETWORK
%token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX ANNOUNCE
-%token ENFORCE NEIGHBORAS CAPABILITIES REFLECTOR DEPEND
+%token ENFORCE NEIGHBORAS CAPABILITIES REFLECTOR DEPEND DOWN
%token DUMP IN OUT
%token LOG ROUTECOLL TRANSPARENT
%token TCP MD5SIG PASSWORD KEY
@@ -608,6 +608,9 @@ peeropts : REMOTEAS asnumber {
| PASSIVE {
curpeer->conf.passive = 1;
}
+ | DOWN {
+ curpeer->conf.down = 1;
+ }
| HOLDTIME number {
if ($2 < MIN_HOLDTIME) {
yyerror("holdtime must be at least %u",
@@ -1482,6 +1485,7 @@ lookup(char *s)
{ "deny", DENY},
{ "depend", DEPEND},
{ "descr", DESCR},
+ { "down", DOWN},
{ "dump", DUMP},
{ "enforce", ENFORCE},
{ "esp", ESP},
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 6922ff3573f..5f1cc83d4a2 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.236 2005/10/19 09:36:51 henning Exp $ */
+/* $OpenBSD: session.c,v 1.237 2005/10/19 10:42:06 henning Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -541,7 +541,10 @@ init_peer(struct peer *p)
peer_cnt++;
change_state(p, STATE_IDLE, EVNT_NONE);
- p->IdleHoldTimer = time(NULL); /* start ASAP */
+ if (p->conf.down)
+ p->IdleHoldTimer = 0; /* no autostart */
+ else
+ p->IdleHoldTimer = time(NULL); /* start ASAP */
}
void