summaryrefslogtreecommitdiff
path: root/proto/ospf/topology.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2015-12-29 15:34:48 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2015-12-29 15:42:12 +0100
commit74c838a87000ca800e8b3f265340c1317989a04a (patch)
tree28070bc0efd51ff30b664b52dd10c7b06b57e4ff /proto/ospf/topology.c
parent9a70c8d6c38155d8abb6d814563b9eefc134e901 (diff)
Move ID allocator to a separate file and use it also in OSPF
Diffstat (limited to 'proto/ospf/topology.c')
-rw-r--r--proto/ospf/topology.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index 59e76019..89bf87c7 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -513,8 +513,7 @@ ospf_update_lsadb(struct ospf_proto *p)
}
}
-
-static inline u32
+static u32
ort_to_lsaid(struct ospf_proto *p, ort *nf)
{
/*
@@ -542,14 +541,17 @@ ort_to_lsaid(struct ospf_proto *p, ort *nf)
* network appeared, we choose a different way.
*
* In OSPFv3, it is simpler. There is not a requirement for membership of the
- * result in the input network, so we just use a hash-based unique ID of a
- * routing table entry for a route that originated given LSA. For ext-LSA, it
- * is an imported route in the nest's routing table (p->table). For summary-LSA,
- * it is a 'source' route in the protocol internal routing table (p->rtf).
+ * result in the input network, so we just allocate a unique ID from ID map
+ * and store it in nf->lsa_id for further reference.
*/
if (ospf_is_v3(p))
- return nf->fn.uid;
+ {
+ if (!nf->lsa_id)
+ nf->lsa_id = idm_alloc(&p->idm);
+
+ return nf->lsa_id;
+ }
net_addr_ip4 *net = (void *) nf->fn.addr;
u32 id = ip4_to_u32(net->prefix);