diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-03-06 18:14:12 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-03-06 18:28:00 +0100 |
commit | 9aa77fccebc4d84b5e1496884cd124d09893041b (patch) | |
tree | 50e9764686620608901dc6e7853b3c1b3e14814a /proto/ospf/rt.c | |
parent | b9deced219cfda2afe8604b24351ae10ac56f98b (diff) |
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.
Diffstat (limited to 'proto/ospf/rt.c')
-rw-r--r-- | proto/ospf/rt.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index c580d06e..6ddd6c9f 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -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); |