open5gs/lib/sbi
Sukchan Lee 783b1dc26f sbi: avoid duplicate NF status subscriptions and clean up local entries on DELETE
This patch addresses a potential subscription_data pool exhaustion
issue observed during repeated NF re-registration with the NRF.

Two improvements are introduced:

1) Prevent duplicate NF status subscriptions
   Before sending a new NF status subscription request, the code now
   checks whether an equivalent subscription already exists in the
   local subscription_data list. If a matching subscription (based on
   req_nf_instance_id and subscr_cond) is found and it is not already
   marked with DELETE_SENT, the new subscription request is skipped.

   This prevents repeated subscription creation during re-registration
   loops.

2) Ensure local cleanup after DELETE response
   When handling HTTP DELETE responses for NF status subscriptions,
   the local subscription_data entry is now removed regardless of the
   response status. Previously, the entry was only removed on
   HTTP 204 (No Content), which could leave stale entries in the local
   list when the NRF returned other statuses (e.g., 404).

   Keeping stale entries could lead to unbounded growth of
   subscription_data and eventual pool exhaustion.

Additionally, successful DELETE operations are logged to improve
debugging visibility.

This change affects all NF state machines that handle subscription
DELETE responses (AMF, AUSF, BSF, NSSF, PCF, SCP, SEPP, SMF, UDM, UDR,
and AF test code).

Issues: #4207
2026-03-13 16:46:00 +09:00
..
contrib Add only one 5GC scenario (call-flow) 2020-06-17 01:22:28 -04:00
custom [SBI] Fix parsing and serialization of _links "item" array (#3897) 2025-05-18 14:32:39 +09:00
openapi [UDM][UDR] Add support for dataset-names resource (#4105) 2025-10-17 09:16:28 +09:00
support [UDM][UDR] Add support for dataset-names resource (#4105) 2025-10-17 09:16:28 +09:00
client.c [SBI] fix compiler errors when using latest libcurl 2025-11-13 06:40:18 +09:00
client.h Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
context.c amf: snapshot RAN-UE ID in SBI transaction to avoid race during SM Context Update 2026-03-05 22:30:31 +09:00
context.h amf: snapshot RAN-UE ID in SBI transaction to avoid race during SM Context Update 2026-03-05 22:30:31 +09:00
conv.c Merge branch 'main' into home-routed 2025-02-09 11:15:55 +09:00
conv.h [NRF] Implemented PLMN list update handling in nrf_nnrf_handle_nf_update (#3566) 2024-12-26 14:38:00 +09:00
meson.build [SBI] Fixed openapitools MAP generation (#2103) 2023-02-26 10:01:08 +09:00
message.c sbi: prevent AMF abort on malformed multipart SBI requests 2026-03-08 19:59:17 +09:00
message.h Remove Duplicated Code 2025-11-15 10:39:24 +09:00
mhd-server.c [SBI] Prevent UAF/double-free by using pool ID in timer callbacks (#4074) 2025-09-17 21:50:47 +09:00
nf-sm.c sbi: avoid duplicate NF status subscriptions and clean up local entries on DELETE 2026-03-13 16:46:00 +09:00
nf-sm.h [SBI] SearchResult.validityPeriod 3600->30s (#3210) 2024-05-17 14:54:32 +09:00
nghttp2-server.c sbi: add HTTP body size limit in nghttp2 server 2026-02-13 11:23:14 +09:00
nnrf-build.c Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
nnrf-build.h Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
nnrf-handler.c sbi: Prevent NFProfile overflow in SMF/AMF info parsing 2026-02-13 17:20:20 +09:00
nnrf-handler.h [SBI] Added Handler for Subscription PATCH (#2152) 2023-03-12 22:06:19 +09:00
nnrf-path.c Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
nnrf-path.h Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
ogs-sbi.h [UDM][UDR] Add support for dataset-names resource (#4105) 2025-10-17 09:16:28 +09:00
path.c [SBI] Fix double-free 2026-01-31 20:17:58 +09:00
path.h Merge branch 'main' into home-routed 2025-01-19 17:11:20 +09:00
server.c Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
server.h Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
timer.c [SBI] Added Handler for Subscription PATCH (#2152) 2023-03-12 22:06:19 +09:00
timer.h [SBI] Added Handler for Subscription PATCH (#2152) 2023-03-12 22:06:19 +09:00
types.c [AMF] API to add or remove PLMNs Dynamically (#4186) 2025-12-03 21:32:59 +09:00
types.h [AMF] API to add or remove PLMNs Dynamically (#4186) 2025-12-03 21:32:59 +09:00
yuarel.c Added NRF 2020-05-18 17:00:37 -04:00
yuarel.h Added NRF 2020-05-18 17:00:37 -04:00