1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

OSPF: Improved handling of tmpattrs

Keep track of whether OSPF tmpattrs are actually defined for given route
(using flags in rte->pflags). That makes them behave more like real
eattrs so a protocol can define just a subset of them or they can be
undefined by filters.

Do not set ospf_metric2 for other than type 2 external OSPF routes and do
not set ospf_tag for non-external OSPF routes. That also fixes a bug
where internal/inter-area route propagated from one OSPF instance to
another is initiated with infinity ospf_metric2.

Thanks to Yaroslav Dronskii for the bugreport.
This commit is contained in:
Ondrej Zajicek (work)
2019-03-06 18:14:12 +01:00
parent b9deced219
commit 9aa77fcceb
4 changed files with 61 additions and 43 deletions

View File

@@ -402,8 +402,6 @@ add_network(struct ospf_area *oa, net_addr *net, int metric, struct top_hash_ent
.type = RTS_OSPF,
.options = 0,
.metric1 = metric,
.metric2 = LSINFINITY,
.tag = 0,
.rid = en->lsa.rt,
.oa = oa,
.nhs = en->nhs
@@ -459,8 +457,6 @@ spfa_process_rt(struct ospf_proto *p, struct ospf_area *oa, struct top_hash_entr
.type = RTS_OSPF,
.options = rt->options,
.metric1 = act->dist,
.metric2 = LSINFINITY,
.tag = 0,
.rid = act->lsa.rt,
.oa = oa,
.nhs = act->nhs
@@ -823,8 +819,6 @@ ospf_rt_sum(struct ospf_area *oa)
.type = RTS_OSPF_IA,
.options = options,
.metric1 = abr->n.metric1 + metric,
.metric2 = LSINFINITY,
.tag = 0,
.rid = en->lsa.rt, /* ABR ID */
.oa = oa,
.nhs = abr->n.nhs
@@ -1563,7 +1557,7 @@ ospf_ext_spf(struct ospf_proto *p)
{
nfa.type = RTS_OSPF_EXT1;
nfa.metric1 = br_metric + rt.metric;
nfa.metric2 = LSINFINITY;
nfa.metric2 = 0;
}
/* Mark the LSA as reachable */
@@ -2033,7 +2027,14 @@ again1:
e->u.ospf.metric2 = nf->old_metric2 = nf->n.metric2;
e->u.ospf.tag = nf->old_tag = nf->n.tag;
e->u.ospf.router_id = nf->old_rid = nf->n.rid;
e->pflags = 0;
e->pflags = EA_ID_FLAG(EA_OSPF_METRIC1) | EA_ID_FLAG(EA_OSPF_ROUTER_ID);
if (nf->n.type == RTS_OSPF_EXT2)
e->pflags |= EA_ID_FLAG(EA_OSPF_METRIC2);
/* Perhaps onfly if tag is non-zero? */
if ((nf->n.type == RTS_OSPF_EXT1) || (nf->n.type == RTS_OSPF_EXT2))
e->pflags |= EA_ID_FLAG(EA_OSPF_TAG);
DBG("Mod rte type %d - %N via %I on iface %s, met %d\n",
a0.source, nf->fn.addr, a0.gw, a0.iface ? a0.iface->name : "(none)", nf->n.metric1);