summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-09-11 14:57:03 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-09-18 11:22:15 +0200
commit2fd1ba4c6d17e9b7fef80a39a951674c541d1cf7 (patch)
tree113d40e37d70788adc4493b0d70376d5e7317e2c
parent6bafa4ce0ddb9e4c97497452f521df5a8cdf703c (diff)
gbproxy: Replace 'mi_data' by 'imsi'
Since at all places where mi_data/mi_data_len is used it will always contain an IMSI. Thus the names of the identifiers have been updated accordingly for clarity. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/include/openbsc/gb_proxy.h8
-rw-r--r--openbsc/src/gprs/gb_proxy.c4
-rw-r--r--openbsc/src/gprs/gb_proxy_tlli.c28
-rw-r--r--openbsc/src/gprs/gb_proxy_vty.c10
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.c28
5 files changed, 39 insertions, 39 deletions
diff --git a/openbsc/include/openbsc/gb_proxy.h b/openbsc/include/openbsc/gb_proxy.h
index 8f37514a0..43eb0beaa 100644
--- a/openbsc/include/openbsc/gb_proxy.h
+++ b/openbsc/include/openbsc/gb_proxy.h
@@ -134,8 +134,8 @@ struct gbproxy_tlli_info {
struct gbproxy_tlli_state sgsn_tlli;
time_t timestamp;
- uint8_t *mi_data;
- size_t mi_data_len;
+ uint8_t *imsi;
+ size_t imsi_len;
int imsi_acq_pending;
struct llist_head stored_msgs;
@@ -195,8 +195,8 @@ struct gbproxy_tlli_info *gbproxy_register_tlli(
struct gbproxy_tlli_info *gbproxy_find_tlli(
struct gbproxy_peer *peer, uint32_t tlli);
-struct gbproxy_tlli_info *gbproxy_find_tlli_by_mi(
- struct gbproxy_peer *peer, const uint8_t *mi_data, size_t mi_data_len);
+struct gbproxy_tlli_info *gbproxy_find_tlli_by_imsi(
+ struct gbproxy_peer *peer, const uint8_t *imsi, size_t imsi_len);
struct gbproxy_tlli_info *gbproxy_find_tlli_by_sgsn_tlli(
struct gbproxy_peer *peer,
uint32_t tlli);
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index dfaa38080..2dfb4d82c 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -362,7 +362,7 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
if (!tlli_info)
return 1;
- if (!tlli_info->imsi_acq_pending && tlli_info->mi_data_len > 0)
+ if (!tlli_info->imsi_acq_pending && tlli_info->imsi_len > 0)
return 1;
if (parse_ctx->g48_hdr &&
@@ -376,7 +376,7 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
}
}
- if (tlli_info->imsi_acq_pending && tlli_info->mi_data_len > 0) {
+ if (tlli_info->imsi_acq_pending && tlli_info->imsi_len > 0) {
int is_ident_resp =
parse_ctx->g48_hdr &&
parse_ctx->g48_hdr->proto_discr == GSM48_PDISC_MM_GPRS &&
diff --git a/openbsc/src/gprs/gb_proxy_tlli.c b/openbsc/src/gprs/gb_proxy_tlli.c
index 58a45aef5..c3dc7baf2 100644
--- a/openbsc/src/gprs/gb_proxy_tlli.c
+++ b/openbsc/src/gprs/gb_proxy_tlli.c
@@ -75,21 +75,21 @@ struct gbproxy_tlli_info *gbproxy_find_tlli_by_sgsn_tlli(
return NULL;
}
-struct gbproxy_tlli_info *gbproxy_find_tlli_by_mi(
+struct gbproxy_tlli_info *gbproxy_find_tlli_by_imsi(
struct gbproxy_peer *peer,
- const uint8_t *mi_data,
- size_t mi_data_len)
+ const uint8_t *imsi,
+ size_t imsi_len)
{
struct gbproxy_tlli_info *tlli_info;
struct gbproxy_patch_state *state = &peer->patch_state;
- if (!gprs_is_mi_imsi(mi_data, mi_data_len))
+ if (!gprs_is_mi_imsi(imsi, imsi_len))
return NULL;
llist_for_each_entry(tlli_info, &state->enabled_tllis, list) {
- if (tlli_info->mi_data_len != mi_data_len)
+ if (tlli_info->imsi_len != imsi_len)
continue;
- if (memcmp(tlli_info->mi_data, mi_data, mi_data_len) != 0)
+ if (memcmp(tlli_info->imsi, imsi, imsi_len) != 0)
continue;
return tlli_info;
@@ -235,11 +235,11 @@ static void gbproxy_update_tlli_info(struct gbproxy_tlli_info *tlli_info,
if (!gprs_is_mi_imsi(imsi, imsi_len))
return;
- tlli_info->mi_data_len = imsi_len;
- tlli_info->mi_data =
- talloc_realloc_size(tlli_info, tlli_info->mi_data, imsi_len);
- OSMO_ASSERT(tlli_info->mi_data != NULL);
- memcpy(tlli_info->mi_data, imsi, imsi_len);
+ tlli_info->imsi_len = imsi_len;
+ tlli_info->imsi =
+ talloc_realloc_size(tlli_info, tlli_info->imsi, imsi_len);
+ OSMO_ASSERT(tlli_info->imsi != NULL);
+ memcpy(tlli_info->imsi, imsi, imsi_len);
}
void gbproxy_reassign_tlli(struct gbproxy_tlli_state *tlli_state,
@@ -335,7 +335,7 @@ struct gbproxy_tlli_info *gbproxy_register_tlli(
tlli_info = gbproxy_find_tlli(peer, tlli);
if (!tlli_info) {
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi, imsi_len);
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi, imsi_len);
if (tlli_info) {
/* TLLI has changed somehow, adjust it */
@@ -427,7 +427,7 @@ struct gbproxy_tlli_info *gbproxy_update_tlli_state_ul(
gbproxy_touch_tlli(peer, tlli_info, now);
}
- if (parse_ctx->imsi && tlli_info && tlli_info->mi_data_len == 0) {
+ if (parse_ctx->imsi && tlli_info && tlli_info->imsi_len == 0) {
int enable_patching;
gbproxy_update_tlli_info(tlli_info,
parse_ctx->imsi, parse_ctx->imsi_len);
@@ -534,7 +534,7 @@ struct gbproxy_tlli_info *gbproxy_update_tlli_state_dl(
gbproxy_touch_tlli(peer, tlli_info, now);
}
- if (parse_ctx->imsi && tlli_info && tlli_info->mi_data_len == 0) {
+ if (parse_ctx->imsi && tlli_info && tlli_info->imsi_len == 0) {
int enable_patching;
gbproxy_update_tlli_info(tlli_info,
parse_ctx->imsi, parse_ctx->imsi_len);
diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c
index fd49b0179..efdf751d9 100644
--- a/openbsc/src/gprs/gb_proxy_vty.c
+++ b/openbsc/src/gprs/gb_proxy_vty.c
@@ -437,11 +437,11 @@ DEFUN(show_gbproxy_tllis, show_gbproxy_tllis_cmd, "show gbproxy tllis",
llist_for_each(iter, &tlli_info->stored_msgs)
stored_msgs++;
- if (tlli_info->mi_data_len > 0) {
+ if (tlli_info->imsi > 0) {
snprintf(mi_buf, sizeof(mi_buf), "(invalid)");
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
- tlli_info->mi_data,
- tlli_info->mi_data_len);
+ tlli_info->imsi,
+ tlli_info->imsi_len);
} else {
snprintf(mi_buf, sizeof(mi_buf), "(none)");
}
@@ -612,8 +612,8 @@ DEFUN(delete_gb_tlli, delete_gb_tlli_cmd,
if (match == MATCH_IMSI) {
mi_buf[0] = '\0';
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
- tlli_info->mi_data,
- tlli_info->mi_data_len);
+ tlli_info->imsi,
+ tlli_info->imsi_len);
if (strcmp(mi_buf, imsi) != 0)
continue;
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index 4e40f3301..bb2e3e5f3 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -126,11 +126,11 @@ static int dump_peers(FILE *stream, int indent, time_t now,
llist_for_each(iter, &tlli_info->stored_msgs)
stored_msgs++;
- if (tlli_info->mi_data_len > 0) {
+ if (tlli_info->imsi_len > 0) {
snprintf(mi_buf, sizeof(mi_buf), "(invalid)");
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
- tlli_info->mi_data,
- tlli_info->mi_data_len);
+ tlli_info->imsi,
+ tlli_info->imsi_len);
} else {
snprintf(mi_buf, sizeof(mi_buf), "(none)");
}
@@ -2780,10 +2780,10 @@ static void test_gbproxy_tlli_expire(void)
dump_peers(stdout, 2, now, &cfg);
/* verify that 5678 has survived */
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi1, ARRAY_SIZE(imsi1));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi1, ARRAY_SIZE(imsi1));
OSMO_ASSERT(tlli_info);
OSMO_ASSERT(tlli_info->tlli.current == tlli2);
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi2, ARRAY_SIZE(imsi2));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi2, ARRAY_SIZE(imsi2));
OSMO_ASSERT(!tlli_info);
printf("\n");
@@ -2819,9 +2819,9 @@ static void test_gbproxy_tlli_expire(void)
dump_peers(stdout, 2, now, &cfg);
/* verify that 5678 has survived */
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi1, ARRAY_SIZE(imsi1));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi1, ARRAY_SIZE(imsi1));
OSMO_ASSERT(!tlli_info);
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi2, ARRAY_SIZE(imsi2));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi2, ARRAY_SIZE(imsi2));
OSMO_ASSERT(tlli_info);
OSMO_ASSERT(tlli_info->tlli.current == tlli1);
@@ -2857,9 +2857,9 @@ static void test_gbproxy_tlli_expire(void)
dump_peers(stdout, 2, now, &cfg);
/* verify that 5678 has survived */
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi1, ARRAY_SIZE(imsi1));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi1, ARRAY_SIZE(imsi1));
OSMO_ASSERT(!tlli_info);
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi2, ARRAY_SIZE(imsi2));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi2, ARRAY_SIZE(imsi2));
OSMO_ASSERT(tlli_info);
OSMO_ASSERT(tlli_info->tlli.current == tlli2);
@@ -2895,9 +2895,9 @@ static void test_gbproxy_tlli_expire(void)
dump_peers(stdout, 2, now + 2, &cfg);
/* verify that 5678 has survived */
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi1, ARRAY_SIZE(imsi1));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi1, ARRAY_SIZE(imsi1));
OSMO_ASSERT(!tlli_info);
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi2, ARRAY_SIZE(imsi2));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi2, ARRAY_SIZE(imsi2));
OSMO_ASSERT(tlli_info);
OSMO_ASSERT(tlli_info->tlli.current == tlli2);
@@ -2941,11 +2941,11 @@ static void test_gbproxy_tlli_expire(void)
dump_peers(stdout, 2, now + 2, &cfg);
/* verify that tlli3 has survived */
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi1, ARRAY_SIZE(imsi1));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi1, ARRAY_SIZE(imsi1));
OSMO_ASSERT(!tlli_info);
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi2, ARRAY_SIZE(imsi2));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi2, ARRAY_SIZE(imsi2));
OSMO_ASSERT(!tlli_info);
- tlli_info = gbproxy_find_tlli_by_mi(peer, imsi3, ARRAY_SIZE(imsi3));
+ tlli_info = gbproxy_find_tlli_by_imsi(peer, imsi3, ARRAY_SIZE(imsi3));
OSMO_ASSERT(tlli_info);
OSMO_ASSERT(tlli_info->tlli.current == tlli3);