summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/bfd/bfd.c8
-rw-r--r--proto/bgp/bgp.c33
-rw-r--r--proto/bgp/config.Y2
-rw-r--r--proto/ospf/iface.c6
4 files changed, 29 insertions, 20 deletions
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c
index 5ebfadc1..89355483 100644
--- a/proto/bfd/bfd.c
+++ b/proto/bfd/bfd.c
@@ -1070,13 +1070,13 @@ bfd_show_sessions(struct proto *P)
if (p->p.proto_state != PS_UP)
{
- cli_msg(-1013, "%s: is not up", p->p.name);
+ cli_msg(-1020, "%s: is not up", p->p.name);
cli_msg(0, "");
return;
}
- cli_msg(-1013, "%s:", p->p.name);
- cli_msg(-1013, "%-25s %-10s %-10s %-10s %8s %8s",
+ cli_msg(-1020, "%s:", p->p.name);
+ cli_msg(-1020, "%-25s %-10s %-10s %-10s %8s %8s",
"IP address", "Interface", "State", "Since", "Interval", "Timeout");
@@ -1092,7 +1092,7 @@ bfd_show_sessions(struct proto *P)
state = (state < 4) ? state : 0;
tm_format_datetime(tbuf, &config->tf_proto, s->last_state_change);
- cli_msg(-1013, "%-25I %-10s %-10s %-10s %3u.%03u %3u.%03u",
+ cli_msg(-1020, "%-25I %-10s %-10s %-10s %3u.%03u %3u.%03u",
s->addr, ifname, bfd_state_names[state], tbuf,
tx_int / 1000, tx_int % 1000, timeout / 1000, timeout % 1000);
}
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 81a263bb..f05a85d4 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -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");
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index ab12fed5..76a76470 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -34,6 +34,7 @@ CF_ADDTO(proto, bgp_proto '}' { bgp_check_config(BGP_CFG); } )
bgp_proto_start: proto_start BGP {
this_proto = proto_config_new(&proto_bgp, sizeof(struct bgp_config), $1);
+ BGP_CFG->multihop = -1; /* undefined */
BGP_CFG->hold_time = 240;
BGP_CFG->connect_retry_time = 120;
BGP_CFG->initial_hold_time = 240;
@@ -74,6 +75,7 @@ bgp_proto:
| bgp_proto STARTUP HOLD TIME expr ';' { BGP_CFG->initial_hold_time = $5; }
| bgp_proto CONNECT RETRY TIME expr ';' { BGP_CFG->connect_retry_time = $5; }
| bgp_proto KEEPALIVE TIME expr ';' { BGP_CFG->keepalive_time = $4; }
+ | bgp_proto DIRECT ';' { BGP_CFG->multihop = 0; }
| bgp_proto MULTIHOP ';' { BGP_CFG->multihop = 64; }
| bgp_proto MULTIHOP expr ';' { BGP_CFG->multihop = $3; if (($3<1) || ($3>255)) cf_error("Multihop must be in range 1-255"); }
| bgp_proto NEXT HOP SELF ';' { BGP_CFG->next_hop_self = 1; BGP_CFG->next_hop_keep = 0; }
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index f1409840..333c2a6d 100644
--- a/proto/ospf/iface.c
+++ b/proto/ospf/iface.c
@@ -472,10 +472,14 @@ ospf_iface_stubby(struct ospf_iface_patt *ip, struct ifa *addr)
if (! addr)
return 0;
- /* a host/loopback address */
+ /* a host address */
if (addr->flags & IA_HOST)
return 1;
+ /* a loopback iface */
+ if (addr->iface->flags & IF_LOOPBACK)
+ return 1;
+
/*
* We cannot properly support multiple OSPF ifaces on real iface
* with multiple prefixes, therefore we force OSPF ifaces with