summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gsm/gsup.h7
-rw-r--r--src/gsm/gsup.c35
-rw-r--r--tests/gsup/gsup_test.err14
3 files changed, 49 insertions, 7 deletions
diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index be856620..49ddb742 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -45,6 +45,7 @@
#include <osmocom/gsm/protocol/gsm_03_40.h>
#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
#include <osmocom/gsm/protocol/gsm_08_08.h>
+#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/crypt/auth.h>
#define OSMO_GSUP_PORT 4222
@@ -86,6 +87,8 @@ enum osmo_gsup_iei {
OSMO_GSUP_AUTS_IE = 0x26,
OSMO_GSUP_RES_IE = 0x27,
OSMO_GSUP_CN_DOMAIN_IE = 0x28,
+ OSMO_GSUP_SUPPORTED_RAT_TYPES_IE = 0x29, /* supported RAT types */
+ OSMO_GSUP_CURRENT_RAT_TYPE_IE = 0x2a, /* currently used RAT type */
OSMO_GSUP_SESSION_ID_IE = 0x30,
OSMO_GSUP_SESSION_STATE_IE = 0x31,
@@ -373,6 +376,10 @@ struct osmo_gsup_message {
/*! Session Management cause as of 3GPP TS 24.008 10.5.6.6 / Table 10.5.157. */
enum gsm48_gsm_cause cause_sm;
+
+ enum osmo_rat_type current_rat_type;
+ enum osmo_rat_type supported_rat_types[8]; /*!< arbitrary choice */
+ size_t supported_rat_types_len;
};
int osmo_gsup_decode(const uint8_t *data, size_t data_len,
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 2e6690ee..2f9d85d8 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -297,6 +297,7 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
struct osmo_gsup_message *gsup_msg)
{
int rc;
+ int i;
uint8_t tag;
/* the shift/match functions expect non-const pointers, but we'll
* either copy the data or cast pointers back to const before returning
@@ -459,6 +460,21 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
gsup_msg->cn_domain = *value;
break;
+ case OSMO_GSUP_SUPPORTED_RAT_TYPES_IE:
+ if (value_len > ARRAY_SIZE(gsup_msg->supported_rat_types)) {
+ LOGP(DLGSUP, LOGL_ERROR, "nr of supported RAT types %zu > %zu\n",
+ value_len, ARRAY_SIZE(gsup_msg->supported_rat_types));
+ return -GMM_CAUSE_COND_IE_ERR;
+ }
+ for (i = 0; i < value_len; i++)
+ gsup_msg->supported_rat_types[i] = value[i];
+ gsup_msg->supported_rat_types_len = value_len;
+ break;
+
+ case OSMO_GSUP_CURRENT_RAT_TYPE_IE:
+ gsup_msg->current_rat_type = *value;
+ break;
+
case OSMO_GSUP_CHARG_CHAR_IE:
gsup_msg->pdp_charg_enc = value;
gsup_msg->pdp_charg_enc_len = value_len;
@@ -856,6 +872,25 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
if ((u8 = gsup_msg->cause_sm))
msgb_tlv_put(msg, OSMO_GSUP_CAUSE_SM_IE, sizeof(u8), &u8);
+ if (gsup_msg->supported_rat_types_len) {
+ int i;
+ uint8_t *len = msgb_tl_put(msg, OSMO_GSUP_SUPPORTED_RAT_TYPES_IE);
+ *len = gsup_msg->supported_rat_types_len;
+ for (i = 0; i < gsup_msg->supported_rat_types_len; i++) {
+ if (!gsup_msg->supported_rat_types[i] ||
+ gsup_msg->supported_rat_types[i] >= OSMO_RAT_COUNT) {
+ LOGP(DLGSUP, LOGL_ERROR, "Failed to encode RAT type %s (nr %d)\n",
+ osmo_rat_type_name(gsup_msg->supported_rat_types[i]), i);
+ return -EINVAL;
+ }
+ msgb_v_put(msg, gsup_msg->supported_rat_types[i]);
+ }
+ }
+ if (gsup_msg->current_rat_type != OSMO_RAT_UNKNOWN) {
+ u8 = gsup_msg->current_rat_type;
+ msgb_tlv_put(msg, OSMO_GSUP_CURRENT_RAT_TYPE_IE, sizeof(u8), &u8);
+ }
+
return 0;
}
diff --git a/tests/gsup/gsup_test.err b/tests/gsup/gsup_test.err
index e5fe6ee3..1da39649 100644
--- a/tests/gsup/gsup_test.err
+++ b/tests/gsup/gsup_test.err
@@ -157,27 +157,27 @@
DLGSUP Stopping DLGSUP logging
message 0: tested 3584 modifications, 771 parse failures
message 1: tested 3584 modifications, 770 parse failures
- message 2: tested 21248 modifications, 2575 parse failures
+ message 2: tested 21248 modifications, 2577 parse failures
message 3: tested 2816 modifications, 510 parse failures
message 4: tested 3584 modifications, 770 parse failures
- message 5: tested 20736 modifications, 4023 parse failures
+ message 5: tested 20736 modifications, 4025 parse failures
message 6: tested 3584 modifications, 771 parse failures
message 7: tested 3584 modifications, 770 parse failures
message 8: tested 2816 modifications, 510 parse failures
message 9: tested 2816 modifications, 510 parse failures
message 10: tested 3584 modifications, 770 parse failures
message 11: tested 3328 modifications, 770 parse failures
- message 12: tested 54016 modifications, 4626 parse failures
- message 13: tested 11520 modifications, 1026 parse failures
+ message 12: tested 54016 modifications, 4628 parse failures
+ message 13: tested 11520 modifications, 1028 parse failures
message 14: tested 5120 modifications, 1030 parse failures
- message 15: tested 10752 modifications, 1262 parse failures
+ message 15: tested 10752 modifications, 1263 parse failures
message 16: tested 7680 modifications, 1271 parse failures
message 17: tested 8448 modifications, 2053 parse failures
- message 18: tested 11264 modifications, 2307 parse failures
+ message 18: tested 11264 modifications, 2308 parse failures
message 19: tested 5120 modifications, 1031 parse failures
message 20: tested 4352 modifications, 1030 parse failures
message 21: tested 3584 modifications, 771 parse failures
- message 22: tested 5632 modifications, 771 parse failures
+ message 22: tested 5632 modifications, 772 parse failures
message 23: tested 3584 modifications, 770 parse failures
message 24: tested 3584 modifications, 771 parse failures
message 25: tested 11264 modifications, 2058 parse failures