proto_item
| RFC1583COMPAT bool { OSPF_CFG->rfc1583 = $2; }
| STUB ROUTER bool { OSPF_CFG->stub_router = $3; }
- | ECMP bool { OSPF_CFG->ecmp = $2 ? DEFAULT_ECMP_LIMIT : 0; }
+ | ECMP bool { OSPF_CFG->ecmp = $2 ? OSPF_DEFAULT_ECMP_LIMIT : 0; }
| ECMP bool LIMIT expr { OSPF_CFG->ecmp = $2 ? $4 : 0; if ($4 < 0) cf_error("ECMP limit cannot be negative"); }
+ | MERGE EXTERNAL bool { OSPF_CFG->merge_external = $3; }
| TICK expr { OSPF_CFG->tick = $2; if($2<=0) cf_error("Tick must be greater than zero"); }
| ospf_area
;
static void
ospf_ext_spf(struct proto_ospf *po)
{
+ struct proto *p = &po->proto;
+ struct top_hash_entry *en;
+ struct ospf_lsa_ext_local rt;
ort *nf1, *nf2;
- orta nfa;
+ orta nfa = {};
- struct top_hash_entry *en;
- struct proto *p = &po->proto;
- struct ospf_lsa_ext *le;
- int pxlen, ebit, rt_fwaddr_valid, rt_propagate;
- ip_addr ip, rtid, rt_fwaddr;
- u32 br_metric, rt_metric, rt_tag;
+ ip_addr rtid;
+ u32 br_metric;
struct ospf_area *atmp;
- struct mpnh* nhs = NULL;
OSPF_TRACE(D_EVENTS, "Starting routing table calculation for ext routes");
/* 16.4. (3) NSSA - special rule for default routes */
/* ABR should use default only if P-bit is set and summaries are active */
- if ((en->lsa.type == LSA_T_NSSA) && ipa_zero(ip) && (pxlen == 0) &&
- (po->areano > 1) && !(rt_propagate && atmp->ac->summary))
+ if ((en->lsa_type == LSA_T_NSSA) && ipa_zero(rt.ip) && (rt.pxlen == 0) &&
+ (po->areano > 1) && !(rt.propagate && atmp->ac->summary))
continue;
- if (!rt_fwaddr_valid)
+ if (!rt.fbit)
{
nf2 = nf1;
- nhs = nf1->n.nhs;
+ nfa.nhs = nf1->n.nhs;
br_metric = nf1->n.metric1;
}
else
if (!nf2->n.nhs)
continue;
- nhs = nf2->n.nhs;
- /* If gw is zero, it is a device route */
- if (ipa_zero(nhs->gw))
- nhs = new_nexthop(po, rt.fwaddr, nhs->iface, nhs->weight);
+ nfa.nhs = nf2->n.nhs;
br_metric = nf2->n.metric1;
- nfa.nhs = fix_device_nexthops(po, nfa.nhs, rt_fwaddr);
+
+ /* Replace device nexthops with nexthops to forwarding address from LSA */
+ if (has_device_nexthops(nfa.nhs))
+ {
++ nfa.nhs = fix_device_nexthops(po, nfa.nhs, rt.fwaddr);
+ nfa.nhs_reuse = 1;
+ }
}
- if (ebit)
+ if (rt.ebit)
{
nfa.type = RTS_OSPF_EXT2;
nfa.metric1 = br_metric;
nfa.options |= ORTA_PROP;
}
- nfa.tag = rt_tag;
+ nfa.tag = rt.tag;
nfa.rid = en->lsa.rt;
nfa.oa = atmp; /* undefined in RFC 2328 */
- nfa.voa = NULL;
- nfa.nhs = nhs;
nfa.en = en; /* store LSA for later (NSSA processing) */
- ri_install_ext(po, ip, pxlen, &nfa);
+ ri_install_ext(po, rt.ip, rt.pxlen, &nfa);
}
}