]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - proto/bgp/bgp.c
Merge branch 'master' into add-path
[thirdparty/bird.git] / proto / bgp / bgp.c
index 81a263bb06de0985d074c732e2a86b9f7f1a010b..f05a85d44d8b41c11bfa049ebcd6767beb364250 100644 (file)
@@ -1009,6 +1009,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");
 
@@ -1024,7 +1042,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");
 
@@ -1035,20 +1052,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");