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:
@@ -325,6 +325,39 @@ rte_cow_rta(rte *r, linpool *lp)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/* Note that rte_make_tmp_attr() requires free eattr in ea_list */
|
||||
void
|
||||
rte_make_tmp_attr(rte *r, ea_list *e, uint id, uint type, u32 val)
|
||||
{
|
||||
if (r->pflags & EA_ID_FLAG(id))
|
||||
{
|
||||
eattr *a = &e->attrs[e->count++];
|
||||
a->id = id;
|
||||
a->type = type | EAF_TEMP;
|
||||
a->flags = 0;
|
||||
a->u.data = val;
|
||||
}
|
||||
}
|
||||
|
||||
/* Note that rte has to be writable */
|
||||
uint
|
||||
rte_store_tmp_attr(rte *r, uint id)
|
||||
{
|
||||
eattr *a;
|
||||
if (a = ea_find(r->attrs->eattrs, id))
|
||||
{
|
||||
r->pflags |= EA_ID_FLAG(id);
|
||||
return a->u.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
r->pflags &= ~EA_ID_FLAG(id);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int /* Actually better or at least as good as */
|
||||
rte_better(rte *new, rte *old)
|
||||
{
|
||||
|
Reference in New Issue
Block a user