summaryrefslogtreecommitdiffstats
path: root/src/gsm
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-29 04:47:42 +0600
committerHarald Welte <laforge@gnumonks.org>2018-01-17 10:45:39 +0000
commitc30431ffc73669c89f15de998c82fd1df42bafcb (patch)
tree7f71b1d035416396b231509035469a7b79d1d211 /src/gsm
parent01b85724afbc4171ab77fcc63ebf7ccd82edefbe (diff)
gsm0480: parse GSM0480_MTYPE_FACILITY separately
Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
Diffstat (limited to 'src/gsm')
-rw-r--r--src/gsm/gsm0480.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index b0b28e43..17657c78 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -196,6 +196,8 @@ struct msgb *gsm0480_create_notifySS(const char *text)
/* Forward declarations */
static int parse_ss(const struct gsm48_hdr *hdr,
uint16_t len, struct ss_request *req);
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+ struct ss_request *req);
static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len,
struct ss_request *req);
static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
@@ -286,9 +288,11 @@ static int parse_ss(const struct gsm48_hdr *hdr, uint16_t len, struct ss_request
req->ussd_text[0] = 0xFF;
break;
case GSM0480_MTYPE_REGISTER:
- case GSM0480_MTYPE_FACILITY:
rc &= parse_ss_info_elements(&hdr->data[0], len - sizeof(*hdr), req);
break;
+ case GSM0480_MTYPE_FACILITY:
+ rc &= parse_ss_facility(&hdr->data[0], len - sizeof(*hdr), req);
+ break;
default:
LOGP(0, LOGL_DEBUG, "Unknown GSM 04.80 message-type field 0x%02x\n",
hdr->msg_type);
@@ -299,6 +303,18 @@ static int parse_ss(const struct gsm48_hdr *hdr, uint16_t len, struct ss_request
return rc;
}
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+ struct ss_request *req)
+{
+ uint8_t facility_length;
+
+ facility_length = ss_facility[0];
+ if (len - 1 < facility_length)
+ return 0;
+
+ return parse_facility_ie(ss_facility + 1, facility_length, req);
+}
+
static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len,
struct ss_request *req)
{