diff options
author | Max <msuraev@sysmocom.de> | 2018-01-08 14:43:53 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-01-19 15:11:00 +0000 |
commit | 25c65c3d1f39f55340180273201cf91a1d10d741 (patch) | |
tree | 43615c9ca564f469e313487339259ee9cb3cb18d /src | |
parent | 6789c84457eb278f4ad144f90c29fd7420899e60 (diff) |
Use gsm48_encode_ra() for RAI encoding
It has stricter type signature which increase the chance of spotting
misuse either via compiler warning or with automated scan. This also
paves the way for gsm48_construct_ra() deprecation in libosmocore.
Change-Id: I2c0f082dc7214ed57a40dad0788e34b838dfac97
Related: OS#1640
Diffstat (limited to 'src')
-rw-r--r-- | src/gprs/gb_proxy_patch.c | 12 | ||||
-rw-r--r-- | src/gprs/gprs_gmm.c | 4 | ||||
-rw-r--r-- | src/gprs/sgsn_libgtp.c | 2 | ||||
-rw-r--r-- | src/libcommon/gsm_data.c | 9 |
4 files changed, 9 insertions, 18 deletions
diff --git a/src/gprs/gb_proxy_patch.c b/src/gprs/gb_proxy_patch.c index 48627550f..1be9c2451 100644 --- a/src/gprs/gb_proxy_patch.c +++ b/src/gprs/gb_proxy_patch.c @@ -32,7 +32,7 @@ extern void *tall_bsc_ctx; /* patch RA identifier in place */ -static void gbproxy_patch_raid(uint8_t *raid_enc, struct gbproxy_peer *peer, +static void gbproxy_patch_raid(struct gsm48_ra_id *raid_enc, struct gbproxy_peer *peer, int to_bss, const char *log_text) { struct gbproxy_patch_state *state = &peer->patch_state; @@ -47,7 +47,7 @@ static void gbproxy_patch_raid(uint8_t *raid_enc, struct gbproxy_peer *peer, if (!state->local_mcc || !state->local_mnc) return; - gsm48_parse_ra(&raid, raid_enc); + gsm48_parse_ra(&raid, (uint8_t *)raid_enc); old_mcc = raid.mcc; old_mnc = raid.mnc; @@ -76,7 +76,7 @@ static void gbproxy_patch_raid(uint8_t *raid_enc, struct gbproxy_peer *peer, old_mcc, old_mnc, raid.lac, raid.rac, raid.mcc, raid.mnc, raid.lac, raid.rac); - gsm48_construct_ra(raid_enc, &raid); + gsm48_encode_ra(raid_enc, &raid); rate_ctr_inc(&peer->ctrg->ctr[counter]); } @@ -233,14 +233,14 @@ int gbproxy_patch_llc(struct msgb *msg, uint8_t *llc, size_t llc_len, } if (parse_ctx->raid_enc) { - gbproxy_patch_raid(parse_ctx->raid_enc, peer, parse_ctx->to_bss, + gbproxy_patch_raid((struct gsm48_ra_id *)parse_ctx->raid_enc, peer, parse_ctx->to_bss, parse_ctx->llc_msg_name); have_patched = 1; } if (parse_ctx->old_raid_enc && !parse_ctx->old_raid_is_foreign) { /* TODO: Patch to invalid if P-TMSI unknown. */ - gbproxy_patch_raid(parse_ctx->old_raid_enc, peer, parse_ctx->to_bss, + gbproxy_patch_raid((struct gsm48_ra_id *)parse_ctx->old_raid_enc, peer, parse_ctx->to_bss, parse_ctx->llc_msg_name); have_patched = 1; } @@ -286,7 +286,7 @@ void gbproxy_patch_bssgp(struct msgb *msg, uint8_t *bssgp, size_t bssgp_len, int err_ctr = -1; if (parse_ctx->bssgp_raid_enc) - gbproxy_patch_raid(parse_ctx->bssgp_raid_enc, peer, + gbproxy_patch_raid((struct gsm48_ra_id *)parse_ctx->bssgp_raid_enc, peer, parse_ctx->to_bss, "BSSGP"); if (parse_ctx->need_decryption && diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index 77a553726..9313e989e 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -448,7 +448,7 @@ static int gsm48_tx_gmm_att_ack(struct sgsn_mm_ctx *mm) aa->att_result = 1; /* GPRS only */ aa->ra_upd_timer = gprs_secs_to_tmr_floor(sgsn->cfg.timers.T3312); aa->radio_prio = 4; /* lowest */ - gsm48_construct_ra((uint8_t *)&aa->ra_id, &mm->ra); + gsm48_encode_ra(&aa->ra_id, &mm->ra); #if 0 /* Optional: P-TMSI signature */ @@ -1505,7 +1505,7 @@ static int gsm48_tx_gmm_ra_upd_ack(struct sgsn_mm_ctx *mm) rua->upd_result = 0; /* RA updated */ rua->ra_upd_timer = gprs_secs_to_tmr_floor(sgsn->cfg.timers.T3312); - gsm48_construct_ra((uint8_t *)&rua->ra_id, &mm->ra); + gsm48_encode_ra(&rua->ra_id, &mm->ra); #if 0 /* Optional: P-TMSI signature */ diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c index 1032230ac..ae293f1dd 100644 --- a/src/gprs/sgsn_libgtp.c +++ b/src/gprs/sgsn_libgtp.c @@ -268,7 +268,7 @@ struct sgsn_pdp_ctx *sgsn_create_pdp_ctx(struct sgsn_ggsn_ctx *ggsn, raid = mmctx->ra; raid.lac = 0xFFFE; raid.rac = 0xFF; - gsm48_construct_ra(pdp->rai.v, &raid); + gsm48_encode_ra((struct gsm48_ra_id *)pdp->rai.v, &raid); /* Encode User Location Information accordint to TS 29.060 7.7.51 */ pdp->userloc_given = 1; diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c index a2837f38f..6400963ae 100644 --- a/src/libcommon/gsm_data.c +++ b/src/libcommon/gsm_data.c @@ -311,15 +311,6 @@ void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts) raid->rac = bts->gprs.rac; } -int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts) -{ - struct gprs_ra_id raid; - - gprs_ra_id_by_bts(&raid, bts); - - return gsm48_construct_ra(buf, &raid); -} - int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char **argv) { int ret; |