Commit bf853fe3 authored by Robert Schmidt's avatar Robert Schmidt

Sanitize NSSAI configuration

Following changes included:
- SD is optional: when value is 0xffffff or not present in config
  (previously: needed to be set to 0)
- Checks SSTs in range [0,255]
- Checks SDs in range [0,0xffffff]
- Correct typo SST defines
parent 474cde3b
......@@ -1465,9 +1465,10 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
NGAP_REGISTER_GNB_REQ (msg_p).num_nssai[l] = SNSSAIParamList.numelt;
for (int s = 0; s < SNSSAIParamList.numelt; ++s) {
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sST = *SNSSAIParamList.paramarray[s][GNB_SLICE_SERIVE_TYPE_IDX].uptr;
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sST = *SNSSAIParamList.paramarray[s][GNB_SLICE_SERVICE_TYPE_IDX].uptr;
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD_flag = 0;
if(*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr != 0) {
if(SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr != 0 // SD is optional
&& *SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr != 0xffffff) { // 0xffffff is "no SD", see 23.003 Sec 28.4.2
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD_flag = 1;
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD[0] = (*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr & 0xFF0000) >> 16;
NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD[1] = (*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr & 0x00FF00) >> 8;
......
......@@ -245,23 +245,24 @@ typedef enum {
#define GNB_CONFIG_STRING_SNSSAI_LIST "snssaiList"
#define GNB_CONFIG_STRING_SLICE_SERIVE_TYPE "sst"
#define GNB_CONFIG_STRING_SLICE_SERVICE_TYPE "sst"
#define GNB_CONFIG_STRING_SLICE_DIFFERENTIATOR "sd"
#define GNB_SLICE_SERIVE_TYPE_IDX 0
#define GNB_SLICE_SERVICE_TYPE_IDX 0
#define GNB_SLICE_DIFFERENTIATOR_IDX 1
#define GNBSNSSAIPARAMS_DESC { \
/* optname helpstr paramflags XXXptr def val type numelt */ \
{GNB_CONFIG_STRING_SLICE_SERIVE_TYPE, "slice serive type", 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SLICE_DIFFERENTIATOR, "slice differentiator", 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
/* optname helpstr paramflags XXXptr def val type numelt */ \
{GNB_CONFIG_STRING_SLICE_SERVICE_TYPE, "slice service type", 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SLICE_DIFFERENTIATOR, "slice differentiator", 0, uptr:NULL, defuintval:0xffffff, TYPE_UINT, 0}, \
}
#define SLICE_SERIVE_TYPE_OKRANGES {1,2,3,4}
#define SLICE_SERVICE_TYPE_OKRANGE {0, 255}
#define SLICE_DIFFERENTIATOR_TYPE_OKRANGE {0, 0xffffff}
#define SNSSAIPARAMS_CHECK { \
{ .s1 = { config_check_intval, SLICE_SERIVE_TYPE_OKRANGES, 4 } }, \
{ .s5 = { NULL } }, \
{ .s2 = { config_check_intrange, SLICE_SERVICE_TYPE_OKRANGE } }, \
{ .s2 = { config_check_intrange, SLICE_DIFFERENTIATOR_TYPE_OKRANGE } }, \
}
/* AMF configuration parameters section name */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment