summaryrefslogtreecommitdiff
path: root/staticd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2025-02-02 21:17:33 +0200
committerGitHub <noreply@github.com>2025-02-02 21:17:33 +0200
commit4f43a33d421973d8229561bae7872770ea254e58 (patch)
treedc3d7520148d752bff80ebe23b74bcdcfcb00c21 /staticd
parent593e3e199a2e5ba7e5aaba592503a45725ace39c (diff)
parent7a466233483fcc3a20792226e47849ca43785d73 (diff)
Merge pull request #17979 from cscarpitta/fix/fix_staticd_sid_notify
staticd: Fix NULL pointer dereference when receiving `ZAPI_SRV6_SID_RELEASED` notification
Diffstat (limited to 'staticd')
-rw-r--r--staticd/static_zebra.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index 057193aa08..6da2dfec90 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -1169,6 +1169,19 @@ static int static_zebra_srv6_sid_notify(ZAPI_CALLBACK_ARGS)
DEBUGD(&static_dbg_srv6, "%s: SRv6 SID %pI6 %s: RELEASED", __func__, &sid_addr,
srv6_sid_ctx2str(buf, sizeof(buf), &ctx));
+ for (ALL_LIST_ELEMENTS_RO(srv6_sids, node, sid)) {
+ if (IPV6_ADDR_SAME(&sid->addr.prefix, &sid_addr)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found || !sid) {
+ zlog_err("SRv6 SID %pI6 %s: not found", &sid_addr,
+ srv6_sid_ctx2str(buf, sizeof(buf), &ctx));
+ return 0;
+ }
+
UNSET_FLAG(sid->flags, STATIC_FLAG_SRV6_SID_VALID);
break;