diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-08-21 15:43:28 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-08-21 15:43:28 +0000 |
commit | 09413d5babedee41e813f85e2e1e4726712d00ed (patch) | |
tree | 8f4ee1a122f76f319c8ecd447c056e31fa764239 /usr.sbin/bgpd | |
parent | 0cb99f2749271e488c6eca9783d527cdd1e75304 (diff) |
Fix for PR6213, peers with 4-byte AS numbers were unable to connect to a
template neighbor because the AS was set before the 4-byte one was parsed.
While there force enforce neighbor-as to no for iBGP peers.
Found and fix tested by Matthias Cramer (cramer (at) swissix.ch)
OK henning@, sthen@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/session.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 29dc559a36b..02ebb3c1324 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.294 2009/07/24 13:09:29 claudio Exp $ */ +/* $OpenBSD: session.c,v 1.295 2009/08/21 15:43:27 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org> @@ -1853,12 +1853,6 @@ parse_open(struct peer *peer) p += sizeof(short_as); as = peer->short_as = ntohs(short_as); - /* if remote-as is zero and it's a cloned neighbor, accept any */ - if (peer->conf.cloned && !peer->conf.remote_as && as != AS_TRANS) { - peer->conf.remote_as = as; - peer->conf.ebgp = (peer->conf.remote_as != conf->as); - } - memcpy(&oholdtime, p, sizeof(oholdtime)); p += sizeof(oholdtime); @@ -1966,6 +1960,15 @@ parse_open(struct peer *peer) } } + /* if remote-as is zero and it's a cloned neighbor, accept any */ + if (peer->conf.cloned && !peer->conf.remote_as && as != AS_TRANS) { + peer->conf.remote_as = as; + peer->conf.ebgp = (peer->conf.remote_as != conf->as); + if (!peer->conf.ebgp) + /* force enforce_as off for iBGP sessions */ + peer->conf.enforce_as = ENFORCE_AS_OFF; + } + if (peer->conf.remote_as != as) { log_peer_warnx(&peer->conf, "peer sent wrong AS %s", log_as(as)); |