diff options
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 23 |
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); } |