summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2004-02-01 19:46:06 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2004-02-01 19:46:06 +0000
commit6b28dc4d8b23f52cf7773f469198e947187b6251 (patch)
treebbd458632bd2ceee9f346f0ede02cbdd49e37b23 /usr.sbin/bgpd
parent3fd41d6dc00ba0ff9f58cae245b2b0a876dc97b6 (diff)
Set sane default announce types according to the peer type. For IBGP use
announce all and for EBGP use announce self. OK henning@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/bgpd.h3
-rw-r--r--usr.sbin/bgpd/config.c5
-rw-r--r--usr.sbin/bgpd/parse.y8
-rw-r--r--usr.sbin/bgpd/rde_decide.c4
4 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index c5a513dd513..e29e6ddc481 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.88 2004/01/28 23:31:28 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.89 2004/02/01 19:46:05 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -118,6 +118,7 @@ struct buf_read {
};
enum announce_type {
+ ANNOUNCE_UNDEF,
ANNOUNCE_SELF,
ANNOUNCE_NONE,
ANNOUNCE_ALL
diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c
index 852bfa58013..672b1078794 100644
--- a/usr.sbin/bgpd/config.c
+++ b/usr.sbin/bgpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.25 2004/01/30 23:24:04 henning Exp $ */
+/* $OpenBSD: config.c,v 1.26 2004/02/01 19:46:05 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -56,6 +56,9 @@ merge_config(struct bgpd_config *xconf, struct bgpd_config *conf,
for (p = peer_l; p != NULL; p = p->next) {
p->conf.ebgp = (p->conf.remote_as != conf->as);
+ if (p->conf.announce_type == ANNOUNCE_UNDEF)
+ p->conf.announce_type = p->conf.ebgp == 0 ?
+ ANNOUNCE_ALL : ANNOUNCE_SELF;
if (!p->conf.id)
p->conf.id = get_id(p);
}
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index c0665585770..71a3f3ae3b4 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.44 2004/01/28 23:49:55 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.45 2004/02/01 19:46:05 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -810,7 +810,7 @@ alloc_peer(void)
p->state = STATE_NONE;
p->next = NULL;
p->conf.distance = 1;
- p->conf.announce_type = ANNOUNCE_SELF;
+ p->conf.announce_type = ANNOUNCE_UNDEF;
p->conf.max_prefix = ULONG_MAX;
return (p);
@@ -832,11 +832,7 @@ new_peer(void)
sizeof(p->conf.descr)) >= sizeof(p->conf.descr))
fatalx("new_peer descr strlcpy");
}
- p->state = STATE_NONE;
p->next = NULL;
- p->conf.distance = 1;
- p->conf.announce_type = ANNOUNCE_SELF;
- p->conf.max_prefix = ULONG_MAX;
return (p);
}
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index a52ba3eedd0..15116572788 100644
--- a/usr.sbin/bgpd/rde_decide.c
+++ b/usr.sbin/bgpd/rde_decide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_decide.c,v 1.25 2004/01/27 16:49:53 henning Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.26 2004/02/01 19:46:05 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -437,6 +437,7 @@ up_generate_updates(struct rde_peer *peer,
/* announce type handling */
switch (peer->conf.announce_type) {
+ case ANNOUNCE_UNDEF:
case ANNOUNCE_NONE:
return;
case ANNOUNCE_ALL:
@@ -471,6 +472,7 @@ up_generate_updates(struct rde_peer *peer,
/* announce type handling */
switch (peer->conf.announce_type) {
+ case ANNOUNCE_UNDEF:
case ANNOUNCE_NONE:
return;
case ANNOUNCE_ALL: