This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgHello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/5680 to look at the new patch set (#2). 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 --- M src/gprs/gb_proxy_patch.c M src/gprs/gprs_gmm.c M src/gprs/sgsn_libgtp.c M src/libcommon/gsm_data.c M tests/gbproxy/gbproxy_test.c 5 files changed, 16 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/80/5680/2 diff --git a/src/gprs/gb_proxy_patch.c b/src/gprs/gb_proxy_patch.c index 4862755..1be9c24 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 @@ 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 @@ 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 @@ } 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 @@ 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 77a5537..9313e98 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -448,7 +448,7 @@ 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 @@ 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 1032230..ae293f1 100644 --- a/src/gprs/sgsn_libgtp.c +++ b/src/gprs/sgsn_libgtp.c @@ -268,7 +268,7 @@ 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 a2837f3..6400963 100644 --- a/src/libcommon/gsm_data.c +++ b/src/libcommon/gsm_data.c @@ -311,15 +311,6 @@ 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; diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c index 3ebdccb..080c96b 100644 --- a/tests/gbproxy/gbproxy_test.c +++ b/tests/gbproxy/gbproxy_test.c @@ -222,9 +222,9 @@ const uint8_t *convert_ra(struct gprs_ra_id *raid) { - static uint8_t buf[6]; - gsm48_construct_ra(buf, raid); - return buf; + static struct gsm48_ra_id r; + gsm48_encode_ra(&r, raid); + return (const uint8_t *)&r; } /* DTAP - Attach Request */ @@ -582,7 +582,7 @@ OSMO_ASSERT(bssgp_msg_size <= sizeof(msg)); - gsm48_construct_ra(msg + 10, raid); + gsm48_encode_ra((struct gsm48_ra_id *)(msg + 10), raid); msg[1] = (uint8_t)(tlli >> 24); msg[2] = (uint8_t)(tlli >> 16); msg[3] = (uint8_t)(tlli >> 8); @@ -713,7 +713,7 @@ msg[5] = (uint8_t)(tlli >> 8); msg[6] = (uint8_t)(tlli >> 0); - gsm48_construct_ra(msg + 9, raid); + gsm48_encode_ra((struct gsm48_ra_id *)(msg + 9), raid); send_ns_unitdata(nsi, "BVC_SUSPEND", src_addr, 0, msg, sizeof(msg)); } @@ -735,7 +735,7 @@ msg[5] = (uint8_t)(tlli >> 8); msg[6] = (uint8_t)(tlli >> 0); - gsm48_construct_ra(msg + 9, raid); + gsm48_encode_ra((struct gsm48_ra_id *)(msg + 9), raid); send_ns_unitdata(nsi, "BVC_SUSPEND_ACK", src_addr, 0, msg, sizeof(msg)); } @@ -795,7 +795,7 @@ if (raid) { msg[bssgp_msg_size] = BSSGP_IE_ROUTEING_AREA; msg[bssgp_msg_size+1] = 0x86; - gsm48_construct_ra(msg + bssgp_msg_size + 2, raid); + gsm48_encode_ra((struct gsm48_ra_id *)(msg + bssgp_msg_size + 2), raid); bssgp_msg_size += 8; } -- To view, visit https://gerrit.osmocom.org/5680 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2c0f082dc7214ed57a40dad0788e34b838dfac97 Gerrit-PatchSet: 2 Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Jenkins Builder