Pcep more testing#21896
Conversation
Greptile SummaryThis PR fixes a crash in
Confidence Score: 3/5The crash fix in path_nb_config.c removes the abort() during NB_EV_VALIDATE but leaves the NB_EV_APPLY dereference of policy without a null check, so a NULL return from nb_running_get_entry at apply time would still crash pathd. The core bug is real and the intent of the fix is correct, but the APPLY path at line 304 calls strlcpy(policy->name) without any null guard after abort_if_not_found was loosened to false. While northbound ordering normally prevents null here, the fix removes the safety-net assertion for APPLY without replacing it. pathd/path_nb_config.c — the NB_EV_APPLY dereference of policy on line 304 after abort_if_not_found was loosened. Important Files Changed
Sequence DiagramsequenceDiagram
participant NB as Northbound Framework
participant CB as pathd_srte_policy_name_modify
participant RDB as Running DB
Note over NB,RDB: First-time policy creation - policy not yet in running DB
NB->>CB: NB_EV_VALIDATE
CB->>RDB: "get_entry(abort_if_not_found=false)"
RDB-->>CB: NULL (policy not yet created)
CB->>CB: if (policy and strlen) skip via NULL guard
CB-->>NB: NB_OK (crash fixed)
NB->>CB: NB_EV_APPLY
CB->>RDB: "get_entry(abort_if_not_found=false)"
RDB-->>CB: policy (should exist after CREATE)
CB->>CB: "strlcpy(policy->name)"
CB-->>NB: NB_OK
Note over CB,RDB: Edge case: NULL at APPLY time causes crash - no null guard
|
The validation code crashes, because the validation code is asking for the nb code to assert if the path does not exist yet. Modify the code such that the non-existence of the policy yet is not a crashable event in validation. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Currently the testing coverage of pathd/pceplib is abysmmally small. Let's add a bit more testing to get greater code coverage of this code. This test suite adds a basic harness to allow for interactions with pceplib as well. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
0d44dce to
77d105a
Compare
Fix a crash in pathd when it receives commands in a certain order, add a test that provides more coverage to pathd and pceplib