diff options
author | Timo Teräs <timo.teras@iki.fi> | 2016-03-30 13:44:03 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2016-03-30 14:29:40 +0300 |
commit | 8cb40c91cdfb00ddf04e88d3ecd40403890d90f7 (patch) | |
tree | 6d6a3de27525820abb740f1fa8347b6f03986bad /ospf6d/ospf6_lsdb.c | |
parent | 86c5d2ee68f7b9c00ae4aeb5c8b3c5d82c5ebffc (diff) | |
download | quagga-8cb40c91cdfb00ddf04e88d3ecd40403890d90f7.tar.bz2 quagga-8cb40c91cdfb00ddf04e88d3ecd40403890d90f7.tar.xz |
cumulus take-3cumulus-take-3
Diffstat (limited to 'ospf6d/ospf6_lsdb.c')
-rw-r--r-- | ospf6d/ospf6_lsdb.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index b5a4587c..d103d23f 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -31,7 +31,9 @@ #include "ospf6_proto.h" #include "ospf6_lsa.h" #include "ospf6_lsdb.h" +#include "ospf6_route.h" #include "ospf6d.h" +#include "bitfield.h" struct ospf6_lsdb * ospf6_lsdb_create (void *data) @@ -545,21 +547,42 @@ ospf6_lsdb_show (struct vty *vty, enum ospf_lsdb_show_level level, } } -/* Decide new Link State ID to originate. - note return value is network byte order */ +/* Decide new Link State ID to originate for the range. */ +u_int32_t +ospf6_new_range_ls_id (struct ospf6_route_table *range_table) +{ + u_int32_t id; + + bf_assign_index(range_table->idspace, id); + return (id); +} + +/* Release the LS ID back to the ID pool */ +void +ospf6_release_range_ls_id (struct ospf6_route_table *range_table, + u_int32_t id) +{ + bf_release_index(range_table->idspace, id); +} + u_int32_t ospf6_new_ls_id (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb) { struct ospf6_lsa *lsa; - u_int32_t id = 1; + u_int32_t id = 1, tmp_id; + /* This routine is curently invoked only for Inter-Prefix LSAs for + * non-summarized routes (no area/range). + */ for (lsa = ospf6_lsdb_type_router_head (type, adv_router, lsdb); lsa; lsa = ospf6_lsdb_type_router_next (type, adv_router, lsa)) { - if (ntohl (lsa->header->id) < id) - continue; - if (ntohl (lsa->header->id) > id) + tmp_id = ntohl (lsa->header->id); + if (tmp_id < id) + continue; + + if (tmp_id > id) { ospf6_lsdb_lsa_unlock (lsa); break; |