summaryrefslogtreecommitdiffstats
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-03-13 12:49:44 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2009-03-13 12:49:44 +0100
commite8ba557c7f66aaf02dd24f554fba8b3607c2b3d5 (patch)
tree64f1e9d86256b1603e8713b973cf8e666aaf2f80 /proto/bgp/bgp.c
parente3299ab14877de6ce688050e550c44cd4e85b212 (diff)
downloadbird-e8ba557c7f66aaf02dd24f554fba8b3607c2b3d5.tar
bird-e8ba557c7f66aaf02dd24f554fba8b3607c2b3d5.zip
Update capability handshake options
Add 'capabilities' option, change default behavior to advertise ipv4, add some checks and ignore incoming capabilities when capabilities are disabled.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 558b1e8..f44d016 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -113,7 +113,7 @@ bgp_open(struct bgp_proto *p)
}
}
- p->start_state = BSS_CONNECT;
+ p->start_state = p->cf->capabilities ? BSS_CONNECT : BSS_CONNECT_NOCAP;
return 0;
}
@@ -823,16 +823,22 @@ bgp_check(struct bgp_config *c)
{
if (!c->local_as)
cf_error("Local AS number must be set");
+
if (!c->remote_as)
cf_error("Neighbor must be configured");
+
if (!bgp_as4_support && c->enable_as4)
cf_error("AS4 support disabled globally");
- if (!c->enable_as4 && (c->local_as > 0xFFFF))
+
+ if (!bgp_as4_support && (c->local_as > 0xFFFF))
cf_error("Local AS number out of range");
- if (!c->enable_as4 && (c->remote_as > 0xFFFF))
- cf_error("Neighbor AS number out of range");
+
+ if (!(c->capabilities && c->enable_as4) && (c->remote_as > 0xFFFF))
+ cf_error("Neighbor AS number out of range (AS4 not available)");
+
if ((c->local_as != c->remote_as) && (c->rr_client))
cf_error("Only internal neighbor can be RR client");
+
if ((c->local_as == c->remote_as) && (c->rs_client))
cf_error("Only external neighbor can be RS client");
}