isisd: Don't corrupt generated LSPs if information exceeds capacity

Standard IS-IS only supports up to 256 fragments per router. Recognize
when the information we want to advertise exceeds 256 fragments and
print a warning in this case instead of overflowing the fragment counter
and overwriting existing LSP fragments.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
Christian Franke 2017-09-22 22:17:20 +02:00
parent b1cebe20cd
commit 789c4dfc0b

View File

@ -1120,9 +1120,20 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
} }
isis_free_tlvs(tlvs); isis_free_tlvs(tlvs);
bool fragment_overflow = false;
frag = lsp; frag = lsp;
for (ALL_LIST_ELEMENTS_RO(fragments, node, tlvs)) { for (ALL_LIST_ELEMENTS_RO(fragments, node, tlvs)) {
if (node != listhead(fragments)) { if (node != listhead(fragments)) {
if (LSP_FRAGMENT(frag->hdr.lsp_id) == 255) {
if (!fragment_overflow) {
fragment_overflow = true;
zlog_warn("ISIS (%s): Too much information for 256 fragments",
area->area_tag);
}
isis_free_tlvs(tlvs);
continue;
}
frag = lsp_next_frag(LSP_FRAGMENT(frag->hdr.lsp_id) + 1, frag = lsp_next_frag(LSP_FRAGMENT(frag->hdr.lsp_id) + 1,
lsp, area, level); lsp, area, level);
} }