summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/parse.y
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-03-23 22:26:35 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-03-23 22:26:35 +0000
commit09e412c5ea466048906589a8ee6631301516164f (patch)
treeef795ee7299cdcf04e5a8e6675aa296d3e1a0843 /usr.sbin/bgpd/parse.y
parent8548c5020c59d84a2d2cd9f6d7b02f69319ae4b5 (diff)
Move the neighbor checking code from merge_config() to neighbor_consistent()
where it belongs. OK henning@
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r--usr.sbin/bgpd/parse.y23
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 5fdff88575c..7865bf13601 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.153 2005/03/16 10:50:26 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.154 2005/03/23 22:26:34 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2117,6 +2117,27 @@ neighbor_consistent(struct peer *p)
return (-1);
}
+ if (!conf->as) {
+ yyerror("AS needs to be given before neighbor definitions");
+ return (-1);
+ }
+
+ /* set default values if they where undefined */
+ 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.enforce_as == ENFORCE_AS_UNDEF)
+ p->conf.enforce_as = p->conf.ebgp == 0 ?
+ ENFORCE_AS_OFF : ENFORCE_AS_ON;
+
+ /* EBGP neighbors are not allowed in route reflector clusters */
+ if (p->conf.reflector_client && p->conf.ebgp) {
+ yyerror("EBGP neighbors are not allowed in route "
+ "reflector clusters");
+ return (-1);
+ }
+
return (0);
}