aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_gb_parse.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-08-21 15:07:11 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-09-02 09:53:38 +0200
commit4b663ac34a993cb1f1aa8e993dfc37bcb6841123 (patch)
treeafafe5a3fcf2f7d3c6a1149dc9928305545861ba /openbsc/src/gprs/gprs_gb_parse.c
parent299389a99fd7f839c3953a2cb48394b6679a6c84 (diff)
gbproxy: Create STATUS message with original PDU
Currently when patching is enabled and an error happens when receiving a message from the SGSN, the patched message is sent back with the PDU_IN_ERROR IE. This patch modifies gbprox_rx_sig_from_sgsn() to copy the message before it is patched, so that the original message can be used with the STATUS message. gbprox_rx_ptp_from_sgsn() does all checks before the message is patched, so copying is not necessary. Since gbprox_rx_sig_from_sgsn() is not called for BSSGP UNITDATA messages and the msgb is already been copied in the gbprox_relay2peer function, the relative performance impact is expected to be low. Note that the PDU IE of STATUS messages received from an MS and forwarded to the SGSN will not be patched. STATUS messages from the SGSN are only logged and not forwarded to the MS. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/gprs/gprs_gb_parse.c')
-rw-r--r--openbsc/src/gprs/gprs_gb_parse.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/openbsc/src/gprs/gprs_gb_parse.c b/openbsc/src/gprs/gprs_gb_parse.c
index f2ab20075..ef4a4d108 100644
--- a/openbsc/src/gprs/gprs_gb_parse.c
+++ b/openbsc/src/gprs/gprs_gb_parse.c
@@ -530,10 +530,13 @@ int gprs_gb_parse_bssgp(uint8_t *bssgp, size_t bssgp_len,
parse_ctx->imsi_len = TLVP_LEN(tp, BSSGP_IE_IMSI);
}
- /* TODO: This is TLLI old, don't confuse with TLLI current, add
- * and use tlli_old_enc instead */
- if (0 && TLVP_PRESENT(tp, BSSGP_IE_TLLI))
- parse_ctx->tlli_enc = (uint8_t *)TLVP_VAL(tp, BSSGP_IE_TLLI);
+ if (TLVP_PRESENT(tp, BSSGP_IE_TLLI)) {
+ if (parse_ctx->tlli_enc)
+ /* This is TLLI old, don't confuse it with TLLI current */
+ parse_ctx->old_tlli_enc = (uint8_t *)TLVP_VAL(tp, BSSGP_IE_TLLI);
+ else
+ parse_ctx->tlli_enc = (uint8_t *)TLVP_VAL(tp, BSSGP_IE_TLLI);
+ }
if (TLVP_PRESENT(tp, BSSGP_IE_TMSI) && pdu_type == BSSGP_PDUT_PAGING_PS)
parse_ctx->ptmsi_enc = (uint8_t *)TLVP_VAL(tp, BSSGP_IE_TMSI);
@@ -581,6 +584,15 @@ void gprs_gb_log_parse_context(struct gprs_gb_parse_context *parse_ctx,
sep = ",";
}
+ if (parse_ctx->old_tlli_enc) {
+ LOGP(DGPRS, LOGL_DEBUG, "%s old TLLI %02x%02x%02x%02x", sep,
+ parse_ctx->old_tlli_enc[0],
+ parse_ctx->old_tlli_enc[1],
+ parse_ctx->old_tlli_enc[2],
+ parse_ctx->old_tlli_enc[3]);
+ sep = ",";
+ }
+
if (parse_ctx->bssgp_raid_enc) {
struct gprs_ra_id raid;
gsm48_parse_ra(&raid, parse_ctx->bssgp_raid_enc);