summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2018-11-10 16:14:40 +0100
committerChristian Franke <chris@opensourcerouting.org>2018-11-10 18:00:57 +0100
commit9337256ebf9e562d30bd03bfa02e37f3158b5ef6 (patch)
treec62d8f84d8f7f3b7727118c56dbf89bd482fdb08 /isisd
parentMerge pull request #3298 from ak503/mpls_te2 (diff)
downloadfrr-9337256ebf9e562d30bd03bfa02e37f3158b5ef6.tar.xz
frr-9337256ebf9e562d30bd03bfa02e37f3158b5ef6.zip
isisd: Fix lsp_build_list_nonzero_ht
When `first` would be initialized to the same value as `last`, the function would return incorrect results. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_lsp.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index bb090f42e..5b34bb37d 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -578,29 +578,17 @@ void lsp_insert(struct isis_lsp *lsp, dict_t *lspdb)
void lsp_build_list_nonzero_ht(uint8_t *start_id, uint8_t *stop_id,
struct list *list, dict_t *lspdb)
{
- dnode_t *first, *last, *curr;
+ for (dnode_t *curr = dict_lower_bound(lspdb, start_id);
+ curr; curr = dict_next(lspdb, curr)) {
+ struct isis_lsp *lsp = curr->dict_data;
- first = dict_lower_bound(lspdb, start_id);
- if (!first)
- return;
-
- last = dict_upper_bound(lspdb, stop_id);
-
- curr = first;
-
- if (((struct isis_lsp *)(curr->dict_data))->hdr.rem_lifetime)
- listnode_add(list, first->dict_data);
-
- while (curr) {
- curr = dict_next(lspdb, curr);
- if (curr
- && ((struct isis_lsp *)(curr->dict_data))->hdr.rem_lifetime)
- listnode_add(list, curr->dict_data);
- if (curr == last)
+ if (memcmp(lsp->hdr.lsp_id, stop_id,
+ ISIS_SYS_ID_LEN + 2) > 0)
break;
- }
- return;
+ if (lsp->hdr.rem_lifetime)
+ listnode_add(list, lsp);
+ }
}
static void lsp_set_time(struct isis_lsp *lsp)