Closed zhou-run closed 5 days ago
@Mergifyio backport dev/10.1 stable/10.0 stable/9.1 stable/9.0
backport dev/10.1 stable/10.0 stable/9.1 stable/9.0
The topotest for OSPF often fails. Should we consider extending the convergence time for testing? @ton31337
When a neighbor connection is disconnected, it may trigger LSP re-generation as a timer task, but this process may be delayed. As a result, the list of neighbors in
area->adjacency_list
may be inconsistent with the neighbors inlsp->tlvs->oldstyle_reach/extended_reach
. For example, thearea->adjacency_list
may lack certain neighbors even though they are present in the LSP. When computing SPF, the call toisis_spf_build_adj_list()
generates thespftree->sadj_list
, which reflects the real neighbors in thearea->adjacency_list
. However, in the case of LAN links,spftree->sadj_list
may include additional pseudo neighbors. The pre-loading of tents through the call toisis_spf_preload_tent()
involves two steps:isis_spf_process_lsp()
is called to generate real neighbor vertices based on the root LSP and pseudo LSP.isis_spf_add_local()
is called to add corresponding next hops to thevertex->Adj_N
list for the real neighbor vertices.In the case of LAN links, the absence of corresponding real neighbors in the
spftree->sadj_list
prevents the execution of the second step. Consequently, thevertex->Adj_N
list for the real neighbor vertices lacks corresponding next hops. This leads to a null pointer access whenisis_lfa_compute()
is called to calculate LFA.As for P2P links, since there are no pseudo neighbors, only the second step is executed, which does not create real neighbor vertices and therefore does not encounter this issue. The backtrace is as follows:
The backtrace provided above pertains to version 8.5.4, but it seems that the same issue exists in the code of the master branch as well.
The scenario where a vertex has no next hop is normal. For example, the "clear isis neighbor" command invokes
isis_vertex_adj_del()
to delete the next hop of a vertex. Upon reviewing all the instances where thevertex->Adj_N
list is used, I found that onlyisis_lfa_compute()
lacks a null check. Therefore, I believe that modifying this part will be sufficient. Additionally, thevertex->parents
list for IP vertices is guaranteed not to be empty.Test scenario: Setting up LFA for LAN links and executing the "clear isis neighbor" command easily reproduces the issue.
Signed-off-by: zhou-run zhou.run@h3c.com