summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-07-12 17:53:26 +0200
committerHolger Freyther <holger@freyther.de>2016-11-18 19:04:37 +0000
commit5085e0bf4c9674fb26754fd16b8e0c58113e1638 (patch)
tree5eabc8bd4caf6fec8d39896b36c933e4c46104ef
parent26f6ced05c8311a93eb4b9c6228ceeb2559c57d0 (diff)
ussd: Add band-aid for interrogationSS
This is a speculative change for interrogateSS and by not answering the request the radio connection would remain open long. The SS/USSD code is from a time where none of knew much about GSM. We do not support SS but should reject it. We have checked for an empty string in the text field to guess if it is a result/release to not send more information. The right way forward is to decode the ASN1 into the fields REQUEST/RESULT(last). Fix an issue and make the code worse. Assume ss_code > 0 to see if this is a interrogate invoke. The issue is that code 0 is a well defined value but unlikely to be used. MAP ASN1 definition: SS-Code ::= OCTET STRING (SIZE (1)) -- This type is used to represent the code identifying a single -- supplementary service, a group of supplementary services, or -- all supplementary services. The services and abbreviations -- used are defined in TS 3GPP TS 22.004 [5]. The internal structure is -- defined as follows: -- -- bits 87654321: group (bits 8765), and specific service -- (bits 4321) allSS SS-Code ::= '00000000'B Change-Id: Ib0dc4485388f030eb172fe21f5327b7ab94751f5
-rw-r--r--openbsc/include/openbsc/gsm_04_80.h4
-rw-r--r--openbsc/src/libmsc/gsm_04_80.c4
-rw-r--r--openbsc/src/libmsc/ussd.c24
3 files changed, 20 insertions, 12 deletions
diff --git a/openbsc/include/openbsc/gsm_04_80.h b/openbsc/include/openbsc/gsm_04_80.h
index 0a6065234..74701ac91 100644
--- a/openbsc/include/openbsc/gsm_04_80.h
+++ b/openbsc/include/openbsc/gsm_04_80.h
@@ -9,10 +9,10 @@ struct gsm_subscriber_connection;
int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
const struct msgb *in_msg, const char* response_text,
- const struct ussd_request *req);
+ const struct ss_request *req);
int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
const struct msgb *msg,
- const struct ussd_request *request);
+ const struct ss_request *request);
int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text);
int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn);
diff --git a/openbsc/src/libmsc/gsm_04_80.c b/openbsc/src/libmsc/gsm_04_80.c
index f1d75f20d..17444555f 100644
--- a/openbsc/src/libmsc/gsm_04_80.c
+++ b/openbsc/src/libmsc/gsm_04_80.c
@@ -63,7 +63,7 @@ static inline unsigned char *msgb_push_TLV1(struct msgb *msgb, uint8_t tag,
/* Send response to a mobile-originated ProcessUnstructuredSS-Request */
int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
const struct msgb *in_msg, const char *response_text,
- const struct ussd_request *req)
+ const struct ss_request *req)
{
struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 USSD RSP");
struct gsm48_hdr *gh;
@@ -111,7 +111,7 @@ int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
const struct msgb *in_msg,
- const struct ussd_request *req)
+ const struct ss_request *req)
{
struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 USSD REJ");
struct gsm48_hdr *gh;
diff --git a/openbsc/src/libmsc/ussd.c b/openbsc/src/libmsc/ussd.c
index 7f01eae71..f12c1f281 100644
--- a/openbsc/src/libmsc/ussd.c
+++ b/openbsc/src/libmsc/ussd.c
@@ -38,19 +38,19 @@
const char USSD_TEXT_OWN_NUMBER[] = "*#100#";
/* Forward declarations of network-specific handler functions */
-static int send_own_number(struct gsm_subscriber_connection *conn, const struct msgb *msg, const struct ussd_request *req);
+static int send_own_number(struct gsm_subscriber_connection *conn, const struct msgb *msg, const struct ss_request *req);
/* Entrypoint - handler function common to all mobile-originated USSDs */
int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
int rc;
- struct ussd_request req;
+ struct ss_request req;
struct gsm48_hdr *gh;
memset(&req, 0, sizeof(req));
gh = msgb_l3(msg);
- rc = gsm0480_decode_ussd_request(gh, msgb_l3len(msg), &req);
+ rc = gsm0480_decode_ss_request(gh, msgb_l3len(msg), &req);
if (!rc) {
DEBUGP(DMM, "Unhandled SS\n");
rc = gsm0480_send_ussd_reject(conn, msg, &req);
@@ -58,15 +58,23 @@ int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg)
return rc;
}
- /* Release-Complete */
- if (req.text[0] == '\0')
+ /* Interrogation or releaseComplete? */
+ if (req.ussd_text[0] == '\0' || req.ussd_text[0] == 0xFF) {
+ if (req.ss_code > 0) {
+ /* Assume interrogateSS or modification of it and reject */
+ rc = gsm0480_send_ussd_reject(conn, msg, &req);
+ msc_release_connection(conn);
+ return rc;
+ }
+ /* Still assuming a Release-Complete and returning */
return 0;
+ }
- if (!strcmp(USSD_TEXT_OWN_NUMBER, (const char *)req.text)) {
+ if (!strcmp(USSD_TEXT_OWN_NUMBER, (const char *)req.ussd_text)) {
DEBUGP(DMM, "USSD: Own number requested\n");
rc = send_own_number(conn, msg, &req);
} else {
- DEBUGP(DMM, "Unhandled USSD %s\n", req.text);
+ DEBUGP(DMM, "Unhandled USSD %s\n", req.ussd_text);
rc = gsm0480_send_ussd_reject(conn, msg, &req);
}
@@ -76,7 +84,7 @@ int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg)
}
/* A network-specific handler function */
-static int send_own_number(struct gsm_subscriber_connection *conn, const struct msgb *msg, const struct ussd_request *req)
+static int send_own_number(struct gsm_subscriber_connection *conn, const struct msgb *msg, const struct ss_request *req)
{
char *own_number = conn->subscr->extension;
char response_string[GSM_EXTENSION_LENGTH + 20];