Changes of Revision 919

open5gs_2.7.2.4572.2ce9.202412252026.dsc -> open5gs_2.7.2.4573.3396.202412262026.dsc Changed
x
 
1
@@ -2,7 +2,7 @@
2
 Source: open5gs
3
 Binary: open5gs-common, open5gs-mme, open5gs-sgwc, open5gs-smf, open5gs-amf, open5gs-sgwu, open5gs-upf, open5gs-hss, open5gs-pcrf, open5gs-nrf, open5gs-scp, open5gs-sepp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg
4
 Architecture: any
5
-Version: 2.7.2.4572.2ce9.202412252026
6
+Version: 2.7.2.4573.3396.202412262026
7
 Maintainer: Harald Welte <laforge@gnumonks.org>
8
 Uploaders: Sukchan Lee <acetcom@gmail.com>
9
 Homepage: https://open5gs.org
10
@@ -32,8 +32,8 @@
11
  open5gs-udr deb net optional arch=any
12
  open5gs-upf deb net optional arch=any
13
 Checksums-Sha1:
14
- 320c871b2c266b73e39a442338c920a9c335ba78 14514812 open5gs_2.7.2.4572.2ce9.202412252026.tar.xz
15
+ 75ba4ca4b9dab98b7c63be745f4e20c67a58753c 14517020 open5gs_2.7.2.4573.3396.202412262026.tar.xz
16
 Checksums-Sha256:
17
- a69a3ea0e1c1e2bcf1aaa98c39b88362d8712ea17998748fced7adbac4a93f38 14514812 open5gs_2.7.2.4572.2ce9.202412252026.tar.xz
18
+ a0e51d6fd95c410ebdc0452b154f6233fcfe3625e446efad12fd9748a4b524c3 14517020 open5gs_2.7.2.4573.3396.202412262026.tar.xz
19
 Files:
20
- bdc2a0df944e375d753fa55574e72b5a 14514812 open5gs_2.7.2.4572.2ce9.202412252026.tar.xz
21
+ fb93d2ff9f0086e5149749a18bbd567d 14517020 open5gs_2.7.2.4573.3396.202412262026.tar.xz
22
open5gs_2.7.2.4572.2ce9.202412252026.tar.xz/.tarball-version -> open5gs_2.7.2.4573.3396.202412262026.tar.xz/.tarball-version Changed
4
 
1
@@ -1 +1 @@
2
-2.7.2.4572-2ce9.202412252026
3
+2.7.2.4573-3396.202412262026
4
open5gs_2.7.2.4572.2ce9.202412252026.tar.xz/debian/changelog -> open5gs_2.7.2.4573.3396.202412262026.tar.xz/debian/changelog Changed
12
 
1
@@ -1,8 +1,8 @@
2
-open5gs (2.7.2.4572.2ce9.202412252026) unstable; urgency=medium
3
+open5gs (2.7.2.4573.3396.202412262026) unstable; urgency=medium
4
 
5
   * Automatically generated changelog entry for building the Osmocom nightly feed
6
 
7
- -- Osmocom OBS scripts <info@osmocom.org>  Wed, 25 Dec 2024 20:27:55 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org>  Thu, 26 Dec 2024 20:27:52 +0000
9
 
10
 open5gs (2.7.2) unstable; urgency=medium
11
 
12
open5gs_2.7.2.4572.2ce9.202412252026.tar.xz/lib/sbi/conv.c -> open5gs_2.7.2.4573.3396.202412262026.tar.xz/lib/sbi/conv.c Changed
37
 
1
@@ -1205,6 +1205,35 @@
2
     OpenAPI_list_free(PlmnList);
3
 }
4
 
5
+/**
6
+ * Compares an ogs_plmn_id_t structure with an OpenAPI_plmn_id_t structure.
7
+ *
8
+ * @param plmn_list The PLMN-ID in ogs_plmn_id_t format.
9
+ * @param PlmnList The PLMN-ID in OpenAPI_plmn_id_t format.
10
+ * @return true if the PLMN-IDs are equal; otherwise, false.
11
+ */
12
+bool ogs_sbi_compare_plmn_list(
13
+        ogs_plmn_id_t *plmn_id, OpenAPI_plmn_id_t *PlmnId)
14
+{
15
+    ogs_plmn_id_t temp_plmn_id;
16
+
17
+    ogs_assert(plmn_id);
18
+    ogs_assert(PlmnId);
19
+    ogs_assert(PlmnId->mcc);
20
+    ogs_assert(PlmnId->mnc);
21
+
22
+    /* Convert OpenAPI_plmn_id_t to ogs_plmn_id_t */
23
+    ogs_sbi_parse_plmn_id(&temp_plmn_id, PlmnId);
24
+
25
+    /* Compare MCC and MNC values */
26
+    if (ogs_plmn_id_mcc(plmn_id) == ogs_plmn_id_mcc(&temp_plmn_id) &&
27
+        ogs_plmn_id_mnc(plmn_id) == ogs_plmn_id_mnc(&temp_plmn_id)) {
28
+        return true;
29
+    }
30
+
31
+    return false;
32
+}
33
+
34
 OpenAPI_plmn_id_nid_t *ogs_sbi_build_plmn_id_nid(ogs_plmn_id_t *plmn_id)
35
 {
36
     OpenAPI_plmn_id_nid_t *PlmnIdNid = NULL;
37
open5gs_2.7.2.4572.2ce9.202412252026.tar.xz/lib/sbi/conv.h -> open5gs_2.7.2.4573.3396.202412262026.tar.xz/lib/sbi/conv.h Changed
10
 
1
@@ -98,6 +98,8 @@
2
 int ogs_sbi_parse_plmn_list(
3
         ogs_plmn_id_t *plmn_list, OpenAPI_list_t *PlmnList);
4
 void ogs_sbi_free_plmn_list(OpenAPI_list_t *PlmnList);
5
+bool ogs_sbi_compare_plmn_list(
6
+        ogs_plmn_id_t *plmn_id, OpenAPI_plmn_id_t *PlmnId);
7
 
8
 OpenAPI_plmn_id_nid_t *ogs_sbi_build_plmn_id_nid(ogs_plmn_id_t *plmn_id);
9
 bool ogs_sbi_parse_plmn_id_nid(
10
open5gs_2.7.2.4572.2ce9.202412252026.tar.xz/lib/sbi/message.h -> open5gs_2.7.2.4573.3396.202412262026.tar.xz/lib/sbi/message.h Changed
9
 
1
@@ -150,6 +150,7 @@
2
 
3
 #define OGS_SBI_PATCH_PATH_NF_STATUS                "/nfStatus"
4
 #define OGS_SBI_PATCH_PATH_LOAD                     "/load"
5
+#define OGS_SBI_PATCH_PATH_PLMN_LIST                "/plmnList"
6
 #define OGS_SBI_PATCH_PATH_VALIDITY_TIME            "/validityTime"
7
 
8
 
9
open5gs_2.7.2.4572.2ce9.202412252026.tar.xz/src/nrf/nnrf-handler.c -> open5gs_2.7.2.4573.3396.202412262026.tar.xz/src/nrf/nnrf-handler.c Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -25,6 +25,15 @@
9
 static void handle_nf_discover_search_result(
10
         OpenAPI_search_result_t *SearchResult);
11
 
12
+/**
13
+ * Handles NF registration in NRF. Validates the PLMN-ID against configured
14
+ * serving PLMN-IDs and registers the NF instance if valid.
15
+ *
16
+ * @param nf_instance The NF instance being registered.
17
+ * @param stream The SBI stream for communication.
18
+ * @param recvmsg The received SBI message.
19
+ * @return true if registration is successful; otherwise, false.
20
+ */
21
 bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
22
         ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
23
 {
24
@@ -33,6 +42,10 @@
25
 
26
     OpenAPI_nf_profile_t *NFProfile = NULL;
27
 
28
+    OpenAPI_lnode_t *node = NULL;
29
+    bool plmn_valid = false;
30
+    int i;
31
+
32
     ogs_assert(nf_instance);
33
     ogs_assert(stream);
34
     ogs_assert(recvmsg);
35
@@ -73,6 +86,41 @@
36
         return false;
37
     }
38
 
39
+    /* Validate the PLMN-ID against configured serving PLMN-IDs */
40
+    if (NFProfile->plmn_list) {
41
+        /* Set PLMN status to invalid */
42
+        plmn_valid = false;
43
+
44
+        if (ogs_local_conf()->num_of_serving_plmn_id > 0 && NFProfile->plmn_list) {
45
+            OpenAPI_list_for_each(NFProfile->plmn_list, node) {
46
+                OpenAPI_plmn_id_t *PlmnId = node->data;
47
+                if (PlmnId == NULL) {
48
+                    continue;
49
+                }
50
+                for (i = 0; i < ogs_local_conf()->num_of_serving_plmn_id; i++) {
51
+                    if (ogs_sbi_compare_plmn_list(
52
+                                &ogs_local_conf()->serving_plmn_idi,
53
+                                PlmnId) == true) {
54
+                        plmn_valid = true;
55
+                        break;
56
+                    }
57
+                }
58
+                if (plmn_valid) {
59
+                    break;
60
+                }
61
+            }
62
+        }
63
+
64
+        /* Reject the registration if PLMN-ID is invalid */
65
+        if (!plmn_valid) {
66
+            ogs_error("PLMN-ID in NFProfile is not allowed");
67
+            ogs_assert(true == ogs_sbi_server_send_error(
68
+                stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, recvmsg,
69
+                "PLMN-ID not allowed", NULL, NULL));
70
+            return false;
71
+        }
72
+    }
73
+
74
     ogs_nnrf_nfm_handle_nf_profile(nf_instance, NFProfile);
75
 
76
     ogs_sbi_client_associate(nf_instance);
77
@@ -146,7 +194,6 @@
78
         if (ogs_local_conf()->num_of_serving_plmn_id &&
79
                 NFProfile->plmn_list == NULL) {
80
             OpenAPI_list_t *PlmnIdList = NULL;
81
-            int i;
82
 
83
             PlmnIdList = OpenAPI_list_create();
84
             ogs_assert(PlmnIdList);
85
@@ -208,6 +255,10 @@
86
     ogs_assert(stream);
87
     ogs_assert(recvmsg);
88
 
89
+    cJSON *plmn_array = NULL, *plmn_item = NULL;
90
+    bool plmn_valid = false;
91
+    int i;
92
+
93
     SWITCH(recvmsg->h.method)
94
     CASE(OGS_SBI_HTTP_METHOD_PUT)
95
         return nrf_nnrf_handle_nf_register(
96
@@ -224,14 +275,14 @@
97
             return false;
98
         }
99
 
100
+        /* Iterate through the PatchItemList */
101
         OpenAPI_list_for_each(PatchItemList, node) {
102
             OpenAPI_patch_item_t *patch_item = node->data;
103
             if (!patch_item) {
104
                 ogs_error("No PatchItem");
105
-                ogs_assert(true ==
106
-                    ogs_sbi_server_send_error(stream,
107
-                        OGS_SBI_HTTP_STATUS_BAD_REQUEST,
108
-                        recvmsg, "No PatchItem", NULL, NULL));
109
+                ogs_assert(true == ogs_sbi_server_send_error(
110
+                    stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, recvmsg,
111
+                    "No PatchItem", NULL, NULL));
112
                 return false;
113
             }
114
 
115
@@ -246,6 +297,102 @@
116
                 break;
117
             CASE(OGS_SBI_PATCH_PATH_LOAD)
118
                 break;
119
+            CASE(OGS_SBI_PATCH_PATH_PLMN_LIST)
120
+                /* Ensure the value is not null and is a valid JSON array */
121
+                if (patch_item->value && patch_item->value->json) {
122
+                    /* Set PLMN status to invalid */
123
+                    plmn_valid = false;
124
+
125
+                    plmn_array = patch_item->value->json;
126
+                    if (!cJSON_IsArray(plmn_array)) {
127
+                        ogs_error("Value for /plmnList is not a JSON array");
128
+                        ogs_assert(true == ogs_sbi_server_send_error(
129
+                            stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, recvmsg,
130
+                            "Invalid value for /plmnList", NULL, NULL));
131
+                        return false;
132
+                    }
133
+
134
+                    /* Clear existing PLMN data in nf_instance */
135
+                    memset(nf_instance->plmn_id, 0,
136
+                            sizeof(nf_instance->plmn_id));
137
+                    nf_instance->num_of_plmn_id = 0;
138
+
139
+                    /* Iterate through the JSON array of PLMN IDs */
140
+                    cJSON_ArrayForEach(plmn_item, plmn_array) {
141
+                        OpenAPI_plmn_id_t plmn_id;
142
+                        memset(&plmn_id, 0, sizeof(plmn_id));
143
+
144
+                        if (nf_instance->num_of_plmn_id >=
145
+                                OGS_ARRAY_SIZE(nf_instance->plmn_id)) {
146
+                            ogs_error("Exceeded maximum number of PLMN IDs");
147
+                            ogs_assert(true == ogs_sbi_server_send_error(
148
+                                stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
149
+                                recvmsg,
150
+                                "Too many PLMN IDs", NULL, NULL));
151
+                            return false;
152
+                        }
153
+
154
+                        /* Parse the PLMN item */
155
+                        plmn_id.mcc = cJSON_GetObjectItem(plmn_item, "mcc")
156
+                                           ? cJSON_GetStringValue(
157
+                                                 cJSON_GetObjectItem(
158
+                                                     plmn_item, "mcc"))
159
+                                           : NULL;
160
+                        plmn_id.mnc = cJSON_GetObjectItem(plmn_item, "mnc")
161
+                                           ? cJSON_GetStringValue(
162
+                                                 cJSON_GetObjectItem(
163
+                                                     plmn_item, "mnc"))
164
+                                           : NULL;
165
+
166
+                        if (!plmn_id.mcc || !plmn_id.mnc) {
167
+                            ogs_error(
168
+                                "Invalid PLMN item in /plmnList update");
169
+                            ogs_assert(true ==
170
+                                       ogs_sbi_server_send_error(
171
+                                           stream,
172
+                                           OGS_SBI_HTTP_STATUS_BAD_REQUEST,
173
+                                           recvmsg,
174
+                                           "Invalid PLMN item", NULL,
175
+                                           NULL));
176
+                            return false;
177
+                        }
178
+
179
+                        /*
180
+                         * Convert OpenAPI_plmn_id_t to ogs_plmn_id_t
181
+                         * and store in nf_instance
182
+                         */
183
+                        ogs_sbi_parse_plmn_id(
184
+                                &nf_instance->
185
+                                    plmn_idnf_instance->num_of_plmn_id,
186
+                                &plmn_id);
187
+                        nf_instance->num_of_plmn_id++;
188
+
189
+                        /* Compare with the serving PLMN list */
190
+                        for (i = 0;
191
+                             i < ogs_local_conf()->num_of_serving_plmn_id;
192
+                             i++) {
193
+                            if (ogs_sbi_compare_plmn_list(
194
+                                        &ogs_local_conf()->serving_plmn_idi,
195
+                                        &plmn_id) == true) {
196
+                                plmn_valid = true;
197
+                                break;
198
+                            }
199
+                        }
200
+                        if (plmn_valid) {
201