Skip to content

Commit 896e120

Browse files
committed
staticd: Fix crash when allocating SIDs without parent locator
In same cases, it may happen staticd attempts to allocate a SID when it does not know about the parent locator yet. In this case, the locator pointer stored inside the SID data structure is NULL. When `static_zebra_request_srv6_sid` attempts to dereference the locator pointer, we get a NULL pointer dereference crash. This commit adds a check to prevent the crash from happening. If the locator pointer is NULL, it means that staticd is not aware about the parent locator yet. Then, staticd should call `static_zebra_srv6_manager_get_locator()` to get the locator from SRv6 Manager. Once staticd receives the requested locator, the existing callback `static_zebra_process_srv6_locator_internal()` will take care of retrying to allocate the SID. Signed-off-by: Carmine Scarpitta <[email protected]>
1 parent e962bff commit 896e120

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

staticd/static_zebra.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,11 @@ extern void static_zebra_request_srv6_sid(struct static_srv6_sid *sid)
921921
if (!sid)
922922
return;
923923

924+
if (!sid->locator) {
925+
static_zebra_srv6_manager_get_locator(sid->locator_name);
926+
return;
927+
}
928+
924929
/* convert `srv6_endpoint_behavior_codepoint` to `seg6local_action_t` */
925930
switch (sid->behavior) {
926931
case SRV6_ENDPOINT_BEHAVIOR_END:

0 commit comments

Comments
 (0)