summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-11-24 12:37:24 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2013-11-24 12:37:24 +0100
commitf3e59178506dab9d54cf19ec701f8d9a7fe283f9 (patch)
treef87f859d42c03ca85f2a47d01e9aa695e8edb209 /proto/bgp/bgp.c
parent52e030e14666ff00a4bb0c700d2c027fbeb87d04 (diff)
Enables multihop mode for IBGP by default.
This is more consistent with common usage and also with the behavior of other implementations (Cisco, Juniper). Also changes the default for gw mode to be based solely on direct/multihop.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index cc5318e8..f5b6b8fc 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -1006,6 +1006,24 @@ bgp_check_config(struct bgp_config *c)
if (c->c.class == SYM_TEMPLATE)
return;
+
+ /* EBGP direct by default, IBGP multihop by default */
+ if (c->multihop < 0)
+ c->multihop = internal ? 64 : 0;
+
+ /* Different default for gw_mode */
+ if (!c->gw_mode)
+ c->gw_mode = c->multihop ? GW_RECURSIVE : GW_DIRECT;
+
+ /* Different default based on rs_client */
+ if (!c->missing_lladdr)
+ c->missing_lladdr = c->rs_client ? MLL_IGNORE : MLL_SELF;
+
+ /* Disable after error incompatible with restart limit action */
+ if (c->c.in_limit && (c->c.in_limit->action == PLA_RESTART) && c->disable_after_error)
+ c->c.in_limit->action = PLA_DISABLE;
+
+
if (!c->local_as)
cf_error("Local AS number must be set");
@@ -1021,7 +1039,6 @@ bgp_check_config(struct bgp_config *c)
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");
@@ -1032,20 +1049,6 @@ bgp_check_config(struct bgp_config *c)
if (c->multihop && c->bfd && ipa_zero(c->source_addr))
cf_error("Multihop BGP with BFD requires specified source address");
-
- /* Different default based on rs_client */
- if (!c->missing_lladdr)
- c->missing_lladdr = c->rs_client ? MLL_IGNORE : MLL_SELF;
-
- /* Different default for gw_mode */
- if (!c->gw_mode)
- c->gw_mode = (c->multihop || internal) ? GW_RECURSIVE : GW_DIRECT;
-
- /* Disable after error incompatible with restart limit action */
- if (c->c.in_limit && (c->c.in_limit->action == PLA_RESTART) && c->disable_after_error)
- c->c.in_limit->action = PLA_DISABLE;
-
-
if ((c->gw_mode == GW_RECURSIVE) && c->c.table->sorted)
cf_error("BGP in recursive mode prohibits sorted table");