-
Notifications
You must be signed in to change notification settings - Fork 46
fix: remove potential panic in SupportDnnLists #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: remove potential panic in SupportDnnLists #482
Conversation
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a safe fallback for DNN selection to prevent a panic when SupportDnnLists
is empty and removes an unused helper method.
- Adds a check to fall back to the first configured DNN or
"internet"
when no default DNN is found - Logs a warning when falling back from UDM subscription defaults
- Removes the now-unused
InSupportDnnList
method
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
gmm/handler.go | Added fallback logic for DNN selection and warning logging |
context/context.go | Removed unused InSupportDnnList helper method |
Comments suppressed due to low confidence (2)
gmm/handler.go:240
- It would be helpful to add unit tests for the fallback branch when SupportDnnLists is empty (leading to the "internet" default) and when SmfSelectionData provides a DNN, to ensure this logic behaves as expected.
if dnn == "" {
context/context.go:449
- Ensure no remaining references to InSupportDnnList exist elsewhere; removing this method might cause compile errors if it was used by any consumers.
context.AmfRanPool.Delete(gnbId)
@patriciareinoso, please rebase your PR and review Copilot's comments/suggestions |
Signed-off-by: Patricia Reinoso <[email protected]>
I am not changing the core behavior of the code so did not expect the E2E tests to fail
and in the other
@gab-arrobo any hint? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
gmm/handler.go
Outdated
dnn = defaultDnn | ||
} | ||
} | ||
ue.GmmLog.Warnf("Subscription context obtained from UDM does not contain the default DNN, using %s", dnn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the warning is in the right place. However, the message is confusing because "the default DNN" message/text implies that we are referring to defaultDNN
(only else
statement). I think it should be something like this:
ue.GmmLog.Warnf("Subscription context obtained from UDM does not contain the default DNN, using %s", dnn) | |
ue.GmmLog.Warnf("Subscription context obtained from UDM does not contain the DNN, using %s", dnn) |
I am unable to replicate the |
Signed-off-by: Patricia Reinoso <[email protected]>
Signed-off-by: Patricia Reinoso <[email protected]>
@@ -45,6 +45,7 @@ const ( | |||
DNN_CONGESTION = "DNN_CONGESTION" | |||
PRIORITIZED_SERVICES_ONLY = "PRIORITIZED_SERVICES_ONLY" | |||
OUT_OF_LADN_SERVICE_AREA = "OUT_OF_LADN_SERVICE_AREA" | |||
defaultDnn = "internet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we should have any hardcoding of default DNN anywhere in the code. Its risky and will lead to issues which would be hard to debug. Could you check if in the webui we add default DNN? We can always make some assumptions that we should always get default DNN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the webui we do not add a default DNN.
In canonical's solution, we do not set the SupportDnnLists
at all, and we do not go trough this branch of the code. I do not know why the e2e tests goes trough that branch of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do see the same thing in my local setup (code goes through the else
statement and ends up running ue.GmmLog.Warnf("Subscription context obtained from UDM does not contain the DNN, using %s", dnn)
FYI, this is the content for ulNasTransport
and as you can see there, DNN
is nil
. What is the value of ulNasTransport
in your setup/test?
2025-07-18T15:44:44.379Z WARN gmm/handler.go:214 GA: ulNasTransport is: &{ExtendedProtocolDiscriminator:{Octet:126} SpareHalfOctetAndSecurityHeaderType:{Octet:0} ULNASTRANSPORTMessageIdentity:{Octet:103} SpareHalfOctetAndPayloadContainerType:{Octet:1} PayloadContainer:{Iei:0 Len:20 Buffer:[46 10 1 193 255 255 145 123 0 10 128 0 10 0 0 13 0 0 3 0]} PduSessionID2Value:0xc001317142 OldPDUSessionID:<nil> RequestType:0xc001317146 SNSSAI:<nil> DNN:<nil> AdditionalInformation:<nil>} {"component": "AMF", "category": "GMM", "amf_ue_ngap_id": "AMF_UE_NGAP_ID:323545", "suci": "suci-0-208-93-0-0-0-0100007511", "supi": "SUPI:imsi-208930100007511"}
Note: I added the above log right before if ulNasTransport.SNSSAI != nil {
ue.GmmLog.Warnf("GA: ulNasTransport is: %+v", ulNasTransport)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the case we should have some way to provide default DNN in AMF. We had added similar support in 4G. I would prefer that approach vs hardcoded internet dnn.
Description
If
SupportDnnLists
is not set in the configuration file, there is a potential panic in the code.If the UE's subscription obtained from the UDM does not contain the default DNN, the AMF willl try to get it from the
ue.SmfSelectionData
. If not found, the AMF will get the DNN fromSupportDnnLists
. IfSupportDnnLists
is empty, it will fallback to "internet" as done in producer/callback.go