Changes of Revision 42

commit_0451b13e0de5b4f41791e135490dfa3251775966.txt Added
commit_7c06eea5b2a5c35898f43de50888c890816c9aa3.txt Deleted
osmo-hlr_1.8.0.2.7c06.dsc -> osmo-hlr_1.8.0.5.0451.dsc Changed
x
 
1
@@ -2,7 +2,7 @@
2
 Source: osmo-hlr
3
 Binary: osmo-hlr, osmo-hlr-dbg, libosmo-gsup-client0, libosmo-gsup-client-dev, libosmo-mslookup1, libosmo-mslookup-dev, osmo-mslookup-utils, osmo-hlr-doc
4
 Architecture: any all
5
-Version: 1.8.0.2.7c06
6
+Version: 1.8.0.5.0451
7
 Maintainer: Osmocom team <openbsc@lists.osmocom.org>
8
 Homepage: https://projects.osmocom.org/projects/osmo-hlr
9
 Standards-Version: 3.9.6
10
@@ -19,8 +19,8 @@
11
  osmo-hlr-doc deb doc optional arch=all
12
  osmo-mslookup-utils deb utils optional arch=any
13
 Checksums-Sha1:
14
- e0dd8774a0bc81595e04f7796f8dfd2febb3b0dc 176692 osmo-hlr_1.8.0.2.7c06.tar.xz
15
+ 57309a444dbf234acb2dbec65eabbbcce793df8a 177876 osmo-hlr_1.8.0.5.0451.tar.xz
16
 Checksums-Sha256:
17
- 2d967e04d4159ee08e1137df09c722ab32f37f4abe0fec8ffcb60a26b85685d4 176692 osmo-hlr_1.8.0.2.7c06.tar.xz
18
+ fce7ada2afb2bf14183027899a72b3479493df8915d449f4d01d501838a9ffb6 177876 osmo-hlr_1.8.0.5.0451.tar.xz
19
 Files:
20
- 7e146c5252804ff8b17aaaaf5b3b2225 176692 osmo-hlr_1.8.0.2.7c06.tar.xz
21
+ 38ed9555a613315a6f7ff8b5f3998ec6 177876 osmo-hlr_1.8.0.5.0451.tar.xz
22
osmo-hlr_1.8.0.2.7c06.tar.xz/.tarball-version -> osmo-hlr_1.8.0.5.0451.tar.xz/.tarball-version Changed
4
 
1
@@ -1 +1 @@
2
-1.8.0.2-7c06
3
+1.8.0.5-0451
4
osmo-hlr_1.8.0.2.7c06.tar.xz/debian/changelog -> osmo-hlr_1.8.0.5.0451.tar.xz/debian/changelog Changed
12
 
1
@@ -1,8 +1,8 @@
2
-osmo-hlr (1.8.0.2.7c06) unstable; urgency=medium
3
+osmo-hlr (1.8.0.5.0451) unstable; urgency=medium
4
 
5
   * Automatically generated changelog entry for building the Osmocom master feed
6
 
7
- -- Osmocom OBS scripts <info@osmocom.org>  Fri, 23 Aug 2024 06:59:02 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org>  Tue, 05 Nov 2024 10:42:38 +0000
9
 
10
 osmo-hlr (1.8.0) unstable; urgency=medium
11
 
12
osmo-hlr_1.8.0.2.7c06.tar.xz/debian/copyright -> osmo-hlr_1.8.0.5.0451.tar.xz/debian/copyright Changed
30
 
1
@@ -6,6 +6,10 @@
2
 Copyright: 2016-2022 Sysmocom s. f. m. c. GmbH <info@sysmocom.de>
3
 License: AGPL-3+
4
 
5
+Files: src/gsupclient/*
6
+Copyright: 2014-2016,2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
7
+License: GPL-2+
8
+
9
 License: AGPL-3+
10
  This program is free software: you can redistribute it and/or modify
11
  it under the terms of the GNU Affero General Public License as published by
12
@@ -19,3 +23,17 @@
13
 
14
  You should have received a copy of the GNU Affero General Public License
15
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
+
17
+License: GPL-2+
18
+ This program is free software; you can redistribute it and/or modify
19
+ it under the terms of the GNU General Public License as published by
20
+ the Free Software Foundation; either version 2 of the License, or
21
+ (at your option) any later version.
22
+
23
+ This program is distributed in the hope that it will be useful,
24
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
+ GNU General Public License for more details.
27
+
28
+ You should have received a copy of the GNU General Public License
29
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
osmo-hlr_1.8.0.2.7c06.tar.xz/include/Makefile.am -> osmo-hlr_1.8.0.5.0451.tar.xz/include/Makefile.am Changed
9
 
1
@@ -3,6 +3,7 @@
2
 nobase_include_HEADERS = \
3
    osmocom/gsupclient/cni_peer_id.h \
4
    osmocom/gsupclient/gsup_client.h \
5
+   osmocom/gsupclient/gsup_client_mux.h \
6
    osmocom/gsupclient/gsup_req.h \
7
    osmocom/mslookup/mdns.h \
8
    osmocom/mslookup/mdns_sock.h \
9
osmo-hlr_1.8.0.5.0451.tar.xz/include/osmocom/gsupclient/gsup_client_mux.h Added
58
 
1
@@ -0,0 +1,56 @@
2
+/*
3
+ * (C) 2019 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
4
+ * All Rights Reserved
5
+ *
6
+ * Author: Neels Hofmeyr
7
+ *
8
+ * SPDX-License-Identifier: GPL-2.0-or-later
9
+ *
10
+ * This program is free software; you can redistribute it and/or modify
11
+ * it under the terms of the GNU General Public License as published by
12
+ * the Free Software Foundation; either version 2 of the License, or
13
+ * (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
+ */
23
+
24
+#pragma once
25
+
26
+#include <osmocom/gsm/gsup.h>
27
+
28
+struct gsup_client_mux;
29
+struct ipaccess_unit;
30
+
31
+struct gsup_client_mux_rx_cb {
32
+   int (*func)(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg);
33
+   void *data;
34
+};
35
+
36
+/* A GSUP client shared between code paths for various GSUP Message Classes.
37
+ * The main task is to dispatch GSUP messages to code paths corresponding to the respective Message Class, i.e.
38
+ * subscriber management, SMS, SS/USSD and inter-MSC messaging.
39
+ * If a GSUP Message Class IE is present in the message, the received message is dispatched directly to the rx_cb entry
40
+ * for that Message Class. Otherwise, the Message Class is determined by a switch() on the Message Type.*/
41
+struct gsup_client_mux {
42
+   struct osmo_gsup_client *gsup_client;
43
+
44
+   /* Target clients by enum osmo_gsup_message_class */
45
+   struct gsup_client_mux_rx_cb rx_cbOSMO_GSUP_MESSAGE_CLASS_ARRAYSIZE;
46
+};
47
+
48
+struct gsup_client_mux *gsup_client_mux_alloc(void *talloc_ctx);
49
+int gsup_client_mux_start(struct gsup_client_mux *gcm, const char *gsup_server_addr_str, uint16_t gsup_server_port,
50
+             struct ipaccess_unit *ipa_dev);
51
+
52
+int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg);
53
+void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm, struct osmo_gsup_message *gsup_msg);
54
+void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig,
55
+                   enum gsm48_gmm_cause cause);
56
+
57
+int gsup_client_mux_rx(struct osmo_gsup_client *gsup_client, struct msgb *msg);
58
osmo-hlr_1.8.0.2.7c06.tar.xz/src/gsupclient/Makefile.am -> osmo-hlr_1.8.0.5.0451.tar.xz/src/gsupclient/Makefile.am Changed
9
 
1
@@ -11,6 +11,7 @@
2
 libosmo_gsup_client_la_SOURCES = \
3
    cni_peer_id.c \
4
    gsup_client.c \
5
+   gsup_client_mux.c \
6
    gsup_req.c \
7
    $(NULL)
8
 
9
osmo-hlr_1.8.0.2.7c06.tar.xz/src/gsupclient/cni_peer_id.c -> osmo-hlr_1.8.0.5.0451.tar.xz/src/gsupclient/cni_peer_id.c Changed
10
 
1
@@ -2,6 +2,8 @@
2
  *
3
  * All Rights Reserved
4
  *
5
+ * SPDX-License-Identifier: GPL-2.0-or-later
6
+ *
7
  * This program is free software; you can redistribute it and/or modify
8
  * it under the terms of the GNU General Public License as published by
9
  * the Free Software Foundation; either version 2 of the License, or
10
osmo-hlr_1.8.0.2.7c06.tar.xz/src/gsupclient/gsup_client.c -> osmo-hlr_1.8.0.5.0451.tar.xz/src/gsupclient/gsup_client.c Changed
10
 
1
@@ -6,6 +6,8 @@
2
  * Author: Jacob Erlbeck
3
  * Author: Neels Hofmeyr
4
  *
5
+ * SPDX-License-Identifier: GPL-2.0-or-later
6
+ *
7
  * This program is free software; you can redistribute it and/or modify
8
  * it under the terms of the GNU General Public License as published by
9
  * the Free Software Foundation; either version 2 of the License, or
10
osmo-hlr_1.8.0.5.0451.tar.xz/src/gsupclient/gsup_client_mux.c Added
196
 
1
@@ -0,0 +1,194 @@
2
+/* Directing individual GSUP messages to their respective handlers. */
3
+/*
4
+ * (C) 2019 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
5
+ * All Rights Reserved
6
+ *
7
+ * Author: Neels Hofmeyr
8
+ *
9
+ * SPDX-License-Identifier: GPL-2.0-or-later
10
+ *
11
+ * This program is free software; you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation; either version 2 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+#include <errno.h>
25
+
26
+#include <osmocom/core/logging.h>
27
+
28
+#include <osmocom/gsupclient/gsup_client.h>
29
+#include <osmocom/gsupclient/gsup_client_mux.h>
30
+
31
+static enum osmo_gsup_message_class gsup_client_mux_classify(struct gsup_client_mux *gcm,
32
+                           const struct osmo_gsup_message *gsup_msg)
33
+{
34
+   if (gsup_msg->message_class)
35
+       return gsup_msg->message_class;
36
+
37
+   LOGP(DLGSUP, LOGL_DEBUG, "No explicit GSUP Message Class, trying to guess from message type %s\n",
38
+        osmo_gsup_message_type_name(gsup_msg->message_type));
39
+
40
+   switch (gsup_msg->message_type) {
41
+   case OSMO_GSUP_MSGT_PROC_SS_REQUEST:
42
+   case OSMO_GSUP_MSGT_PROC_SS_RESULT:
43
+   case OSMO_GSUP_MSGT_PROC_SS_ERROR:
44
+       return OSMO_GSUP_MESSAGE_CLASS_USSD;
45
+
46
+   /* GSM 04.11 code implementing MO SMS */
47
+   case OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR:
48
+   case OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT:
49
+   case OSMO_GSUP_MSGT_READY_FOR_SM_ERROR:
50
+   case OSMO_GSUP_MSGT_READY_FOR_SM_RESULT:
51
+   case OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST:
52
+       return OSMO_GSUP_MESSAGE_CLASS_SMS;
53
+
54
+   default:
55
+       return OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT;
56
+   }
57
+}
58
+
59
+/* Non-static for unit tests */
60
+int gsup_client_mux_rx(struct osmo_gsup_client *gsup_client, struct msgb *msg)
61
+{
62
+   struct gsup_client_mux *gcm = gsup_client->data;
63
+   struct osmo_gsup_message gsup;
64
+   enum osmo_gsup_message_class message_class;
65
+   int rc;
66
+
67
+   rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup);
68
+   if (rc < 0) {
69
+       LOGP(DLGSUP, LOGL_ERROR, "Failed to decode GSUP message: '%s' (%d)  %s\n",
70
+            get_value_string(gsm48_gmm_cause_names, -rc), -rc, osmo_hexdump(msg->data, msg->len));
71
+       goto msgb_free_and_return;
72
+   }
73
+
74
+   if (!gsup.imsi0) {
75
+       LOGP(DLGSUP, LOGL_ERROR, "Failed to decode GSUP message: missing IMSI\n");
76
+       if (OSMO_GSUP_IS_MSGT_REQUEST(gsup.message_type))
77
+           gsup_client_mux_tx_error_reply(gcm, &gsup, GMM_CAUSE_INV_MAND_INFO);
78
+       rc = -GMM_CAUSE_INV_MAND_INFO;
79
+       goto msgb_free_and_return;
80
+   }
81
+
82
+   message_class = gsup_client_mux_classify(gcm, &gsup);
83
+
84
+   if (message_class <= OSMO_GSUP_MESSAGE_CLASS_UNSET || message_class >= ARRAY_SIZE(gcm->rx_cb)) {
85
+       LOGP(DLGSUP, LOGL_ERROR, "Failed to classify GSUP message target\n");
86
+       rc = -EINVAL;
87
+       goto msgb_free_and_return;
88
+   }
89
+
90
+   if (!gcm->rx_cbmessage_class.func) {
91
+       LOGP(DLGSUP, LOGL_ERROR, "No receiver set up for GSUP Message Class %s\n", osmo_gsup_message_class_name(message_class));
92
+       rc = -ENOTSUP;
93
+       goto msgb_free_and_return;
94
+   }
95
+
96
+   rc = gcm->rx_cbmessage_class.func(gcm, gcm->rx_cbmessage_class.data, &gsup);
97
+
98
+msgb_free_and_return:
99
+   msgb_free(msg);
100
+   return rc;
101
+}
102
+
103
+/* Make it clear that struct gsup_client_mux should be talloc allocated, so that it can be used as talloc parent. */
104
+struct gsup_client_mux *gsup_client_mux_alloc(void *talloc_ctx)
105
+{
106
+   return talloc_zero(talloc_ctx, struct gsup_client_mux);
107
+}
108
+
109
+/* Start a GSUP client to serve this gsup_client_mux. */
110
+int gsup_client_mux_start(struct gsup_client_mux *gcm, const char *gsup_server_addr_str, uint16_t gsup_server_port,
111
+             struct ipaccess_unit *ipa_dev)
112
+{
113
+   gcm->gsup_client = osmo_gsup_client_create2(gcm, ipa_dev,
114
+                           gsup_server_addr_str,
115
+                           gsup_server_port,
116
+                           &gsup_client_mux_rx, NULL);
117
+   if (!gcm->gsup_client)
118
+       return -ENOMEM;
119
+   gcm->gsup_client->data = gcm;
120
+   return 0;
121
+}
122
+
123
+int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg)
124
+{
125
+   struct msgb *msg;
126
+   int rc;
127
+
128
+   if (!gcm || !gcm->gsup_client) {
129
+       LOGP(DLGSUP, LOGL_ERROR, "GSUP link is down, cannot send GSUP message\n");
130
+       return -ENOTSUP;
131
+   }
132
+
133
+   msg = osmo_gsup_client_msgb_alloc();
134
+   rc = osmo_gsup_encode(msg, gsup_msg);
135
+   if (rc < 0) {
136
+       LOGP(DLGSUP, LOGL_ERROR, "Failed to encode GSUP message: '%s'\n", strerror(-rc));
137
+       return rc;
138
+   }
139
+
140
+   return osmo_gsup_client_send(gcm->gsup_client, msg);
141
+}
142
+
143
+/* Set GSUP source_name to our local IPA name */
144
+void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm,
145
+                  struct osmo_gsup_message *gsup_msg)
146
+{
147
+   const char *local_msc_name;
148
+
149
+   if (!gcm)
150
+       return;
151
+   if (!gcm->gsup_client)
152
+       return;
153
+   if (!gcm->gsup_client->ipa_dev)
154
+       return;
155
+   local_msc_name = gcm->gsup_client->ipa_dev->serno;
156
+   if (!local_msc_name)
157
+       return;
158
+   gsup_msg->source_name = (const uint8_t *) local_msc_name;
159
+   gsup_msg->source_name_len = strlen(local_msc_name) + 1;
160
+}
161
+
162
+/* Transmit GSUP error in response to original message */
163
+void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig,
164
+                   enum gsm48_gmm_cause cause)
165
+{
166
+   struct osmo_gsup_message gsup_reply;
167
+
168
+   /* No need to answer if we couldn't parse an ERROR message type, only REQUESTs need an error reply. */
169
+   if (!OSMO_GSUP_IS_MSGT_REQUEST(gsup_orig->message_type))
170
+       return;
171
+
172
+   gsup_reply = (struct osmo_gsup_message){
173
+       .cause = cause,
174
+       .message_type = OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type),
175
+       .message_class = gsup_orig->message_class,
176
+       .destination_name = gsup_orig->source_name,
177
+       .destination_name_len = gsup_orig->source_name_len,
178
+
179
+       /* RP-Message-Reference is mandatory for SM Service */
180
+       .sm_rp_mr = gsup_orig->sm_rp_mr,
181
+   };
182
+
183
+   OSMO_STRLCPY_ARRAY(gsup_reply.imsi, gsup_orig->imsi);
184
+   gsup_client_mux_tx_set_source(gcm, &gsup_reply);
185
+
186
+   /* For SS/USSD, it's important to keep both session state and ID IEs */
187
+   if (gsup_orig->session_state != OSMO_GSUP_SESSION_STATE_NONE) {
188
+       gsup_reply.session_state = OSMO_GSUP_SESSION_STATE_END;
189
+       gsup_reply.session_id = gsup_orig->session_id;
190
+   }
191
+
192
+   if (osmo_gsup_client_enc_send(gcm->gsup_client, &gsup_reply))
193
+       LOGP(DLGSUP, LOGL_ERROR, "Failed to send Error reply (imsi=%s)\n",
194
+            osmo_quote_str(gsup_orig->imsi, -1));
195
+}
196
osmo-hlr_1.8.0.2.7c06.tar.xz/src/gsupclient/gsup_req.c -> osmo-hlr_1.8.0.5.0451.tar.xz/src/gsupclient/gsup_req.c Changed
10
 
1
@@ -2,6 +2,8 @@
2
  *
3
  * All Rights Reserved
4
  *
5
+ * SPDX-License-Identifier: GPL-2.0-or-later
6
+ *
7
  * This program is free software; you can redistribute it and/or modify
8
  * it under the terms of the GNU General Public License as published by
9
  * the Free Software Foundation; either version 2 of the License, or
10