aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2017-07-20 10:13:28 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 03:52:46 +0200
commit006a2957503593dd4dff5fb7ecee618cdc8669cb (patch)
tree17fb74bae79947dfd5fcb825597d7d50d5230ac4 /src/gprs
parentf4f6772e3bb75abd2b7e9fd601a728a05d9f710f (diff)
sgsn: Convert cch_pdp to host order for libgtp
libgtp is calling gtpie_tv2 which will convert this uint16_t from host to network order. So far libosmogsm and the sgsn treated the charging characteristics as opaque data. So when moving from byte array to the uint16_t do the swapping. Change-Id: I977aec2e2f8d57802e45f591754e5733562d5c2a
Diffstat (limited to 'src/gprs')
-rw-r--r--src/gprs/sgsn_libgtp.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c
index 0a0de0808..bc2fcd1e4 100644
--- a/src/gprs/sgsn_libgtp.c
+++ b/src/gprs/sgsn_libgtp.c
@@ -235,11 +235,8 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn,
}
/* charging characteristics if present */
- if (TLVP_LEN(tp, OSMO_IE_GSM_CHARG_CHAR) > 0) {
- OSMO_ASSERT(TLVP_LEN(tp, OSMO_IE_GSM_CHARG_CHAR) <= sizeof(pdp->cch_pdp));
- memcpy(&pdp->cch_pdp, TLVP_VAL(tp, OSMO_IE_GSM_CHARG_CHAR),
- TLVP_LEN(tp, OSMO_IE_GSM_CHARG_CHAR));
- }
+ if (TLVP_LEN(tp, OSMO_IE_GSM_CHARG_CHAR) >= sizeof(pdp->cch_pdp))
+ pdp->cch_pdp = tlvp_val16be(tp, OSMO_IE_GSM_CHARG_CHAR);
/* SGSN address for control plane */
pdp->gsnlc.l = sizeof(sgsn->cfg.gtp_listenaddr.sin_addr);