summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-07-13 12:48:23 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2010-07-13 12:48:23 +0200
commit087cecd0e2db0ec1e630fde67ec560578264bf32 (patch)
treeae14fb43b9010219a20799ab39d13a9d541956f1 /proto/bgp/bgp.c
parentf038f0a6385d7b81f57254e3c9bf84021a6b040d (diff)
Adds some options and documentation related to recursive next hops.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 3aa8845e..1f723aee 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -951,6 +951,8 @@ bgp_store_error(struct bgp_proto *p, struct bgp_conn *c, u8 class, u32 code)
void
bgp_check(struct bgp_config *c)
{
+ int internal = (c->local_as == c->remote_as);
+
if (!c->local_as)
cf_error("Local AS number must be set");
@@ -960,15 +962,22 @@ bgp_check(struct bgp_config *c)
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))
+ if (!internal && c->rr_client)
cf_error("Only internal neighbor can be RR client");
- if ((c->local_as == c->remote_as) && (c->rs_client))
+ if (internal && c->rs_client)
cf_error("Only external neighbor can be RS client");
+ if (c->multihop && (c->gw_mode == GW_DIRECT))
+ cf_error("Multihop BGP cannot use direct gateway mode");
+
/* Different default based on rs_client */
- if (c->missing_lladdr == 0)
+ if (!c->missing_lladdr)
c->missing_lladdr = c->rs_client ? MLL_DROP : MLL_SELF;
+
+ /* Different default for gw_mode */
+ if (!c->gw_mode)
+ c->gw_mode = (c->multihop || internal) ? GW_RECURSIVE : GW_DIRECT;
}
static char *bgp_state_names[] = { "Idle", "Connect", "Active", "OpenSent", "OpenConfirm", "Established", "Close" };