aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/src/gprs')
-rw-r--r--openbsc/src/gprs/gb_proxy.c108
-rw-r--r--openbsc/src/gprs/gb_proxy_patch.c26
-rw-r--r--openbsc/src/gprs/gb_proxy_peer.c2
-rw-r--r--openbsc/src/gprs/gb_proxy_tlli.c398
-rw-r--r--openbsc/src/gprs/gb_proxy_vty.c50
5 files changed, 292 insertions, 292 deletions
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index b5566e3d2..130ab4ee1 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -234,7 +234,7 @@ uint32_t gbproxy_make_bss_ptmsi(struct gbproxy_peer *peer,
bss_ptmsi = rand_r(&peer->cfg->bss_ptmsi_state);
bss_ptmsi = bss_ptmsi | 0xC0000000;
- if (gbproxy_tlli_info_by_ptmsi(peer, bss_ptmsi))
+ if (gbproxy_link_info_by_ptmsi(peer, bss_ptmsi))
bss_ptmsi = GSM_RESERVED_TMSI;
} while (bss_ptmsi == GSM_RESERVED_TMSI && max_retries--);
}
@@ -246,15 +246,15 @@ uint32_t gbproxy_make_bss_ptmsi(struct gbproxy_peer *peer,
}
uint32_t gbproxy_make_sgsn_tlli(struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info,
+ struct gbproxy_link_info *link_info,
uint32_t bss_tlli)
{
uint32_t sgsn_tlli;
int max_retries = 23;
if (!peer->cfg->patch_ptmsi) {
sgsn_tlli = bss_tlli;
- } else if (tlli_info->sgsn_tlli.ptmsi != GSM_RESERVED_TMSI) {
- sgsn_tlli = gprs_tmsi2tlli(tlli_info->sgsn_tlli.ptmsi,
+ } else if (link_info->sgsn_tlli.ptmsi != GSM_RESERVED_TMSI) {
+ sgsn_tlli = gprs_tmsi2tlli(link_info->sgsn_tlli.ptmsi,
TLLI_FOREIGN);
} else {
do {
@@ -262,7 +262,7 @@ uint32_t gbproxy_make_sgsn_tlli(struct gbproxy_peer *peer,
sgsn_tlli = rand_r(&peer->cfg->sgsn_tlli_state);
sgsn_tlli = (sgsn_tlli & 0x7fffffff) | 0x78000000;
- if (gbproxy_tlli_info_by_any_sgsn_tlli(peer, sgsn_tlli))
+ if (gbproxy_link_info_by_any_sgsn_tlli(peer, sgsn_tlli))
sgsn_tlli = 0;
} while (!sgsn_tlli && max_retries--);
}
@@ -274,33 +274,33 @@ uint32_t gbproxy_make_sgsn_tlli(struct gbproxy_peer *peer,
}
/* Returns != 0 iff IMSI acquisition was in progress */
-static int gbproxy_restart_imsi_acquisition(struct gbproxy_tlli_info* tlli_info)
+static int gbproxy_restart_imsi_acquisition(struct gbproxy_link_info* link_info)
{
int in_progress = 0;
- if (!tlli_info)
+ if (!link_info)
return 0;
- if (tlli_info->imsi_acq_pending) {
+ if (link_info->imsi_acq_pending) {
in_progress = 1;
- tlli_info->imsi_acq_retries += 1;
+ link_info->imsi_acq_retries += 1;
}
- gbproxy_tlli_info_discard_messages(tlli_info);
- tlli_info->imsi_acq_pending = 0;
+ gbproxy_link_info_discard_messages(link_info);
+ link_info->imsi_acq_pending = 0;
return in_progress;
}
-static void gbproxy_reset_imsi_acquisition(struct gbproxy_tlli_info* tlli_info)
+static void gbproxy_reset_imsi_acquisition(struct gbproxy_link_info* link_info)
{
- gbproxy_restart_imsi_acquisition(tlli_info);
- tlli_info->imsi_acq_retries = 0;
+ gbproxy_restart_imsi_acquisition(link_info);
+ link_info->imsi_acq_retries = 0;
}
static void gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
struct msgb *msg,
time_t now,
- struct gbproxy_tlli_info* tlli_info,
+ struct gbproxy_link_info* link_info,
struct gprs_gb_parse_context *parse_ctx)
{
int rc;
@@ -314,7 +314,7 @@ static void gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
msgb_nsei(msg));
/* Patch and flush stored messages towards the SGSN */
- while ((stored_msg = msgb_dequeue(&tlli_info->stored_msgs))) {
+ while ((stored_msg = msgb_dequeue(&link_info->stored_msgs))) {
struct gprs_gb_parse_context tmp_parse_ctx = {0};
tmp_parse_ctx.to_bss = 0;
tmp_parse_ctx.peer_nsei = msgb_nsei(stored_msg);
@@ -325,14 +325,14 @@ static void gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
&tmp_parse_ctx);
gbproxy_patch_bssgp(msg, msgb_bssgph(stored_msg),
msgb_bssgp_len(stored_msg),
- peer, tlli_info, &len_change,
+ peer, link_info, &len_change,
&tmp_parse_ctx);
- gbproxy_update_tlli_state_after(peer, tlli_info, now,
+ gbproxy_update_link_state_after(peer, link_info, now,
&tmp_parse_ctx);
rc = gbprox_relay2sgsn(peer->cfg, stored_msg,
- msgb_bvci(msg), tlli_info->sgsn_nsei);
+ msgb_bvci(msg), link_info->sgsn_nsei);
if (rc < 0)
LOGP(DLLC, LOGL_ERROR,
@@ -346,7 +346,7 @@ static void gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
}
static void gbproxy_acquire_imsi(struct gbproxy_peer *peer,
- struct gbproxy_tlli_info* tlli_info,
+ struct gbproxy_link_info* link_info,
uint16_t bvci)
{
struct msgb *idreq_msg;
@@ -362,14 +362,14 @@ static void gbproxy_acquire_imsi(struct gbproxy_peer *peer,
* be an issue when P-TMSI patching is _not_ enabled and the SGSN
* doesn't reset V(UT) after a detach. */
gprs_push_llc_ui(idreq_msg, 0, GPRS_SAPI_GMM,
- (tlli_info->imsi_acq_retries + 256) % 512);
- gprs_push_bssgp_dl_unitdata(idreq_msg, tlli_info->tlli.current);
+ (link_info->imsi_acq_retries + 256) % 512);
+ gprs_push_bssgp_dl_unitdata(idreq_msg, link_info->tlli.current);
gbprox_relay2peer(idreq_msg, peer, bvci);
msgb_free(idreq_msg);
}
static void gbproxy_tx_detach_acc(struct gbproxy_peer *peer,
- struct gbproxy_tlli_info* tlli_info,
+ struct gbproxy_link_info* link_info,
uint16_t bvci)
{
struct msgb *detacc_msg;
@@ -378,8 +378,8 @@ static void gbproxy_tx_detach_acc(struct gbproxy_peer *peer,
detacc_msg = gsm48_msgb_alloc();
gprs_put_mo_detach_acc(detacc_msg);
gprs_push_llc_ui(detacc_msg, 0, GPRS_SAPI_GMM,
- (tlli_info->imsi_acq_retries + 256) % 512);
- gprs_push_bssgp_dl_unitdata(detacc_msg, tlli_info->tlli.current);
+ (link_info->imsi_acq_retries + 256) % 512);
+ gprs_push_bssgp_dl_unitdata(detacc_msg, link_info->tlli.current);
gbprox_relay2peer(detacc_msg, peer, bvci);
msgb_free(detacc_msg);
}
@@ -388,15 +388,15 @@ static void gbproxy_tx_detach_acc(struct gbproxy_peer *peer,
static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
struct msgb *msg,
time_t now,
- struct gbproxy_tlli_info* tlli_info,
+ struct gbproxy_link_info* link_info,
struct gprs_gb_parse_context *parse_ctx)
{
struct msgb *stored_msg;
- if (!tlli_info)
+ if (!link_info)
return 1;
- if (!tlli_info->imsi_acq_pending && tlli_info->imsi_len > 0)
+ if (!link_info->imsi_acq_pending && link_info->imsi_len > 0)
return 1;
if (parse_ctx->g48_hdr)
@@ -404,7 +404,7 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
{
case GSM48_MT_GMM_RA_UPD_REQ:
case GSM48_MT_GMM_ATTACH_REQ:
- if (gbproxy_restart_imsi_acquisition(tlli_info)) {
+ if (gbproxy_restart_imsi_acquisition(link_info)) {
LOGP(DLLC, LOGL_INFO,
"NSEI=%d(BSS) IMSI acquisition was in progress "
"when receiving an %s.\n",
@@ -413,7 +413,7 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
break;
case GSM48_MT_GMM_DETACH_REQ:
/* Nothing has been sent to the SGSN yet */
- if (tlli_info->imsi_acq_pending) {
+ if (link_info->imsi_acq_pending) {
LOGP(DLLC, LOGL_INFO,
"NSEI=%d(BSS) IMSI acquisition was in progress "
"when receiving a DETACH_REQ.\n",
@@ -424,26 +424,26 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
"NSEI=%d(BSS) IMSI not yet acquired, "
"faking a DETACH_ACC.\n",
msgb_nsei(msg));
- gbproxy_tx_detach_acc(peer, tlli_info, msgb_bvci(msg));
+ gbproxy_tx_detach_acc(peer, link_info, msgb_bvci(msg));
parse_ctx->invalidate_tlli = 1;
}
- gbproxy_reset_imsi_acquisition(tlli_info);
- gbproxy_update_tlli_state_after(peer, tlli_info, now,
+ gbproxy_reset_imsi_acquisition(link_info);
+ gbproxy_update_link_state_after(peer, link_info, now,
parse_ctx);
return 0;
}
- if (tlli_info->imsi_acq_pending && tlli_info->imsi_len > 0) {
+ if (link_info->imsi_acq_pending && link_info->imsi_len > 0) {
int is_ident_resp =
parse_ctx->g48_hdr &&
parse_ctx->g48_hdr->proto_discr == GSM48_PDISC_MM_GPRS &&
parse_ctx->g48_hdr->msg_type == GSM48_MT_GMM_ID_RESP;
/* The IMSI is now available */
- gbproxy_flush_stored_messages(peer, msg, now, tlli_info,
+ gbproxy_flush_stored_messages(peer, msg, now, link_info,
parse_ctx);
- gbproxy_reset_imsi_acquisition(tlli_info);
+ gbproxy_reset_imsi_acquisition(link_info);
/* This message is most probably the response to the ident
* request sent by gbproxy_acquire_imsi(). Don't forward it to
@@ -461,22 +461,22 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
parse_ctx->llc_msg_name ? parse_ctx->llc_msg_name : "BSSGP");
stored_msg = gprs_msgb_copy(msg, "process_bssgp_ul");
- msgb_enqueue(&tlli_info->stored_msgs, stored_msg);
+ msgb_enqueue(&link_info->stored_msgs, stored_msg);
- if (!tlli_info->imsi_acq_pending) {
+ if (!link_info->imsi_acq_pending) {
LOGP(DLLC, LOGL_INFO,
"NSEI=%d(BSS) IMSI is required but not available, "
"initiating identification procedure (%s)\n",
msgb_nsei(msg),
parse_ctx->llc_msg_name ? parse_ctx->llc_msg_name : "BSSGP");
- gbproxy_acquire_imsi(peer, tlli_info, msgb_bvci(msg));
+ gbproxy_acquire_imsi(peer, link_info, msgb_bvci(msg));
/* There is no explicit retransmission handling, the
* implementation relies on the MS doing proper retransmissions
* of the triggering message instead */
- tlli_info->imsi_acq_pending = 1;
+ link_info->imsi_acq_pending = 1;
}
return 0;
@@ -518,7 +518,7 @@ static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg,
int rc;
int len_change = 0;
time_t now;
- struct gbproxy_tlli_info *tlli_info = NULL;
+ struct gbproxy_link_info *link_info = NULL;
uint32_t sgsn_nsei = cfg->nsip_sgsn_nsei;
if (!cfg->core_mcc && !cfg->core_mnc && !cfg->core_apn &&
@@ -556,7 +556,7 @@ static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg,
gprs_gb_log_parse_context(&parse_ctx, "BSSGP");
- tlli_info = gbproxy_update_tlli_state_ul(peer, now, &parse_ctx);
+ link_info = gbproxy_update_link_state_ul(peer, now, &parse_ctx);
if (parse_ctx.g48_hdr) {
switch (parse_ctx.g48_hdr->msg_type) {
@@ -569,28 +569,28 @@ static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg,
}
}
- if (tlli_info && cfg->route_to_sgsn2) {
- if (cfg->acquire_imsi && tlli_info->imsi_len == 0)
+ if (link_info && cfg->route_to_sgsn2) {
+ if (cfg->acquire_imsi && link_info->imsi_len == 0)
sgsn_nsei = 0xffff;
- else if (gbproxy_imsi_matches(peer, tlli_info))
+ else if (gbproxy_imsi_matches(peer, link_info))
sgsn_nsei = cfg->nsip_sgsn2_nsei;
}
- if (tlli_info)
- tlli_info->sgsn_nsei = sgsn_nsei;
+ if (link_info)
+ link_info->sgsn_nsei = sgsn_nsei;
/* Handle IMSI acquisition */
if (cfg->acquire_imsi) {
- rc = gbproxy_imsi_acquisition(peer, msg, now, tlli_info,
+ rc = gbproxy_imsi_acquisition(peer, msg, now, link_info,
&parse_ctx);
if (rc <= 0)
return rc;
}
gbproxy_patch_bssgp(msg, msgb_bssgph(msg), msgb_bssgp_len(msg),
- peer, tlli_info, &len_change, &parse_ctx);
+ peer, link_info, &len_change, &parse_ctx);
- gbproxy_update_tlli_state_after(peer, tlli_info, now, &parse_ctx);
+ gbproxy_update_link_state_after(peer, link_info, now, &parse_ctx);
if (sgsn_nsei != cfg->nsip_sgsn_nsei) {
/* Send message directly to the selected SGSN */
@@ -611,7 +611,7 @@ static void gbprox_process_bssgp_dl(struct gbproxy_config *cfg,
int rc;
int len_change = 0;
time_t now;
- struct gbproxy_tlli_info *tlli_info = NULL;
+ struct gbproxy_link_info *link_info = NULL;
if (!cfg->core_mcc && !cfg->core_mnc && !cfg->core_apn &&
!cfg->acquire_imsi && !cfg->patch_ptmsi && !cfg->route_to_sgsn2)
@@ -655,12 +655,12 @@ static void gbprox_process_bssgp_dl(struct gbproxy_config *cfg,
gprs_gb_log_parse_context(&parse_ctx, "BSSGP");
- tlli_info = gbproxy_update_tlli_state_dl(peer, now, &parse_ctx);
+ link_info = gbproxy_update_link_state_dl(peer, now, &parse_ctx);
gbproxy_patch_bssgp(msg, msgb_bssgph(msg), msgb_bssgp_len(msg),
- peer, tlli_info, &len_change, &parse_ctx);
+ peer, link_info, &len_change, &parse_ctx);
- gbproxy_update_tlli_state_after(peer, tlli_info, now, &parse_ctx);
+ gbproxy_update_link_state_after(peer, link_info, now, &parse_ctx);
return;
}
diff --git a/openbsc/src/gprs/gb_proxy_patch.c b/openbsc/src/gprs/gb_proxy_patch.c
index 93b85880c..cf6eb8887 100644
--- a/openbsc/src/gprs/gb_proxy_patch.c
+++ b/openbsc/src/gprs/gb_proxy_patch.c
@@ -192,20 +192,20 @@ static int gbproxy_patch_ptmsi(uint8_t *ptmsi_enc,
int gbproxy_patch_llc(struct msgb *msg, uint8_t *llc, size_t llc_len,
struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info, int *len_change,
+ struct gbproxy_link_info *link_info, int *len_change,
struct gprs_gb_parse_context *parse_ctx)
{
struct gprs_llc_hdr_parsed *ghp = &parse_ctx->llc_hdr_parsed;
int have_patched = 0;
int fcs;
- if (parse_ctx->ptmsi_enc && tlli_info &&
+ if (parse_ctx->ptmsi_enc && link_info &&
!parse_ctx->old_raid_is_foreign && peer->cfg->patch_ptmsi) {
uint32_t ptmsi;
if (parse_ctx->to_bss)
- ptmsi = tlli_info->tlli.ptmsi;
+ ptmsi = link_info->tlli.ptmsi;
else
- ptmsi = tlli_info->sgsn_tlli.ptmsi;
+ ptmsi = link_info->sgsn_tlli.ptmsi;
if (ptmsi != GSM_RESERVED_TMSI) {
if (gbproxy_patch_ptmsi(parse_ctx->ptmsi_enc, peer,
@@ -216,12 +216,12 @@ int gbproxy_patch_llc(struct msgb *msg, uint8_t *llc, size_t llc_len,
}
}
- if (parse_ctx->new_ptmsi_enc && tlli_info && peer->cfg->patch_ptmsi) {
+ if (parse_ctx->new_ptmsi_enc && link_info && peer->cfg->patch_ptmsi) {
uint32_t ptmsi;
if (parse_ctx->to_bss)
- ptmsi = tlli_info->tlli.ptmsi;
+ ptmsi = link_info->tlli.ptmsi;
else
- ptmsi = tlli_info->sgsn_tlli.ptmsi;
+ ptmsi = link_info->sgsn_tlli.ptmsi;
OSMO_ASSERT(ptmsi);
if (gbproxy_patch_ptmsi(parse_ctx->new_ptmsi_enc, peer,
@@ -245,7 +245,7 @@ int gbproxy_patch_llc(struct msgb *msg, uint8_t *llc, size_t llc_len,
if (parse_ctx->apn_ie &&
peer->cfg->core_apn &&
!parse_ctx->to_bss &&
- gbproxy_imsi_matches(peer, tlli_info) && peer->cfg->core_apn) {
+ gbproxy_imsi_matches(peer, link_info) && peer->cfg->core_apn) {
size_t new_len;
gbproxy_patch_apn_ie(msg,
parse_ctx->apn_ie, parse_ctx->apn_ie_len,
@@ -275,7 +275,7 @@ int gbproxy_patch_llc(struct msgb *msg, uint8_t *llc, size_t llc_len,
/* patch BSSGP message to use core_mcc/mnc on the SGSN side */
void gbproxy_patch_bssgp(struct msgb *msg, uint8_t *bssgp, size_t bssgp_len,
struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info, int *len_change,
+ struct gbproxy_link_info *link_info, int *len_change,
struct gprs_gb_parse_context *parse_ctx)
{
const char *err_info = NULL;
@@ -296,7 +296,7 @@ void gbproxy_patch_bssgp(struct msgb *msg, uint8_t *bssgp, size_t bssgp_len,
goto patch_error;
}
- if (!tlli_info && parse_ctx->tlli_enc && parse_ctx->to_bss) {
+ if (!link_info && parse_ctx->tlli_enc && parse_ctx->to_bss) {
/* Happens with unknown (not cached) TLLI coming from
* the SGSN */
/* TODO: What shall be done with the message in this case? */
@@ -305,12 +305,12 @@ void gbproxy_patch_bssgp(struct msgb *msg, uint8_t *bssgp, size_t bssgp_len,
goto patch_error;
}
- if (!tlli_info)
+ if (!link_info)
return;
if (parse_ctx->tlli_enc && peer->cfg->patch_ptmsi) {
uint32_t tlli = gbproxy_map_tlli(parse_ctx->tlli,
- tlli_info, parse_ctx->to_bss);
+ link_info, parse_ctx->to_bss);
if (tlli) {
gbproxy_patch_tlli(parse_ctx->tlli_enc, peer, tlli,
@@ -329,7 +329,7 @@ void gbproxy_patch_bssgp(struct msgb *msg, uint8_t *bssgp, size_t bssgp_len,
size_t llc_len = parse_ctx->llc_len;
int llc_len_change = 0;
- gbproxy_patch_llc(msg, llc, llc_len, peer, tlli_info,
+ gbproxy_patch_llc(msg, llc, llc_len, peer, link_info,
&llc_len_change, parse_ctx);
/* Note that the APN might have been resized here, but no
* pointer int the parse_ctx will refer to an adress after the
diff --git a/openbsc/src/gprs/gb_proxy_peer.c b/openbsc/src/gprs/gb_proxy_peer.c
index 335b46f16..8f9066567 100644
--- a/openbsc/src/gprs/gb_proxy_peer.c
+++ b/openbsc/src/gprs/gb_proxy_peer.c
@@ -172,7 +172,7 @@ void gbproxy_peer_free(struct gbproxy_peer *peer)
{
llist_del(&peer->list);
- gbproxy_delete_tlli_infos(peer);
+ gbproxy_delete_link_infos(peer);
rate_ctr_group_free(peer->ctrg);
peer->ctrg = NULL;
diff --git a/openbsc/src/gprs/gb_proxy_tlli.c b/openbsc/src/gprs/gb_proxy_tlli.c
index 70f2bfb62..14ce7d86b 100644
--- a/openbsc/src/gprs/gb_proxy_tlli.c
+++ b/openbsc/src/gprs/gb_proxy_tlli.c
@@ -32,140 +32,140 @@
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/talloc.h>
-struct gbproxy_tlli_info *gbproxy_tlli_info_by_tlli(struct gbproxy_peer *peer,
+struct gbproxy_link_info *gbproxy_link_info_by_tlli(struct gbproxy_peer *peer,
uint32_t tlli)
{
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
struct gbproxy_patch_state *state = &peer->patch_state;
- llist_for_each_entry(tlli_info, &state->enabled_tllis, list)
- if (tlli_info->tlli.current == tlli ||
- tlli_info->tlli.assigned == tlli)
- return tlli_info;
+ llist_for_each_entry(link_info, &state->enabled_tllis, list)
+ if (link_info->tlli.current == tlli ||
+ link_info->tlli.assigned == tlli)
+ return link_info;
return NULL;
}
-struct gbproxy_tlli_info *gbproxy_tlli_info_by_ptmsi(
+struct gbproxy_link_info *gbproxy_link_info_by_ptmsi(
struct gbproxy_peer *peer,
uint32_t ptmsi)
{
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
struct gbproxy_patch_state *state = &peer->patch_state;
- llist_for_each_entry(tlli_info, &state->enabled_tllis, list)
- if (tlli_info->tlli.ptmsi == ptmsi)
- return tlli_info;
+ llist_for_each_entry(link_info, &state->enabled_tllis, list)
+ if (link_info->tlli.ptmsi == ptmsi)
+ return link_info;
return NULL;
}
-struct gbproxy_tlli_info *gbproxy_tlli_info_by_any_sgsn_tlli(
+struct gbproxy_link_info *gbproxy_link_info_by_any_sgsn_tlli(
struct gbproxy_peer *peer,
uint32_t tlli)
{
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
struct gbproxy_patch_state *state = &peer->patch_state;
/* Don't care about the NSEI */
- llist_for_each_entry(tlli_info, &state->enabled_tllis, list)
- if (tlli_info->sgsn_tlli.current == tlli ||
- tlli_info->sgsn_tlli.assigned == tlli)
- return tlli_info;
+ llist_for_each_entry(link_info, &state->enabled_tllis, list)
+ if (link_info->sgsn_tlli.current == tlli ||
+ link_info->sgsn_tlli.assigned == tlli)
+ return link_info;
return NULL;
}
-struct gbproxy_tlli_info *gbproxy_tlli_info_by_sgsn_tlli(
+struct gbproxy_link_info *gbproxy_link_info_by_sgsn_tlli(
struct gbproxy_peer *peer,
uint32_t tlli, uint32_t sgsn_nsei)
{
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
struct gbproxy_patch_state *state = &peer->patch_state;
- llist_for_each_entry(tlli_info, &state->enabled_tllis, list)
- if ((tlli_info->sgsn_tlli.current == tlli ||
- tlli_info->sgsn_tlli.assigned == tlli) &&
- tlli_info->sgsn_nsei == sgsn_nsei)
- return tlli_info;
+ llist_for_each_entry(link_info, &state->enabled_tllis, list)
+ if ((link_info->sgsn_tlli.current == tlli ||
+ link_info->sgsn_tlli.assigned == tlli) &&
+ link_info->sgsn_nsei == sgsn_nsei)
+ return link_info;
return NULL;
}
-struct gbproxy_tlli_info *gbproxy_tlli_info_by_imsi(
+struct gbproxy_link_info *gbproxy_link_info_by_imsi(
struct gbproxy_peer *peer,
const uint8_t *imsi,
size_t imsi_len)
{
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
struct gbproxy_patch_state *state = &peer->patch_state;
if (!gprs_is_mi_imsi(imsi, imsi_len))
return NULL;
- llist_for_each_entry(tlli_info, &state->enabled_tllis, list) {
- if (tlli_info->imsi_len != imsi_len)
+ llist_for_each_entry(link_info, &state->enabled_tllis, list) {
+ if (link_info->imsi_len != imsi_len)
continue;
- if (memcmp(tlli_info->imsi, imsi, imsi_len) != 0)
+ if (memcmp(link_info->imsi, imsi, imsi_len) != 0)
continue;
- return tlli_info;
+ return link_info;
}
return NULL;
}
-void gbproxy_tlli_info_discard_messages(struct gbproxy_tlli_info *tlli_info)
+void gbproxy_link_info_discard_messages(struct gbproxy_link_info *link_info)
{
struct msgb *msg, *nxt;
- llist_for_each_entry_safe(msg, nxt, &tlli_info->stored_msgs, list) {
+ llist_for_each_entry_safe(msg, nxt, &link_info->stored_msgs, list) {
llist_del(&msg->list);
msgb_free(msg);
}
}
-void gbproxy_delete_tlli_info(struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info)
+void gbproxy_delete_link_info(struct gbproxy_peer *peer,
+ struct gbproxy_link_info *link_info)
{
struct gbproxy_patch_state *state = &peer->patch_state;
- gbproxy_tlli_info_discard_messages(tlli_info);
+ gbproxy_link_info_discard_messages(link_info);
- llist_del(&tlli_info->list);
- talloc_free(tlli_info);
+ llist_del(&link_info->list);
+ talloc_free(link_info);
state->enabled_tllis_count -= 1;
peer->ctrg->ctr[GBPROX_PEER_CTR_TLLI_CACHE_SIZE].current =
state->enabled_tllis_count;
}
-void gbproxy_delete_tlli_infos(struct gbproxy_peer *peer)
+void gbproxy_delete_link_infos(struct gbproxy_peer *peer)
{
- struct gbproxy_tlli_info *tlli_info, *nxt;
+ struct gbproxy_link_info *link_info, *nxt;
struct gbproxy_patch_state *state = &peer->patch_state;
- llist_for_each_entry_safe(tlli_info, nxt, &state->enabled_tllis, list)
- gbproxy_delete_tlli_info(peer, tlli_info);
+ llist_for_each_entry_safe(link_info, nxt, &state->enabled_tllis, list)
+ gbproxy_delete_link_info(peer, link_info);
OSMO_ASSERT(state->enabled_tllis_count == 0);
OSMO_ASSERT(llist_empty(&state->enabled_tllis));
}
-void gbproxy_attach_tlli_info(struct gbproxy_peer *peer, time_t now,
- struct gbproxy_tlli_info *tlli_info)
+void gbproxy_attach_link_info(struct gbproxy_peer *peer, time_t now,
+ struct gbproxy_link_info *link_info)
{
struct gbproxy_patch_state *state = &peer->patch_state;
- tlli_info->timestamp = now;
- llist_add(&tlli_info->list, &state->enabled_tllis);
+ link_info->timestamp = now;
+ llist_add(&link_info->list, &state->enabled_tllis);
state->enabled_tllis_count += 1;
peer->ctrg->ctr[GBPROX_PEER_CTR_TLLI_CACHE_SIZE].current =
state->enabled_tllis_count;
}
-int gbproxy_remove_stale_tlli_infos(struct gbproxy_peer *peer, time_t now)
+int gbproxy_remove_stale_link_infos(struct gbproxy_peer *peer, time_t now)
{
struct gbproxy_patch_state *state = &peer->patch_state;
int exceeded_max_len = 0;
@@ -179,27 +179,27 @@ int gbproxy_remove_stale_tlli_infos(struct gbproxy_peer *peer, time_t now)
check_for_age = peer->cfg->tlli_max_age > 0;
for (; exceeded_max_len > 0; exceeded_max_len--) {
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
OSMO_ASSERT(!llist_empty(&state->enabled_tllis));
- tlli_info = llist_entry(state->enabled_tllis.prev,
- struct gbproxy_tlli_info,
+ link_info = llist_entry(state->enabled_tllis.prev,
+ struct gbproxy_link_info,
list);
LOGP(DGPRS, LOGL_INFO,
"Removing TLLI %08x from list "
"(stale, length %d, max_len exceeded)\n",
- tlli_info->tlli.current, state->enabled_tllis_count);
+ link_info->tlli.current, state->enabled_tllis_count);
- gbproxy_delete_tlli_info(peer, tlli_info);
+ gbproxy_delete_link_info(peer, link_info);
deleted_count += 1;
}
while (check_for_age && !llist_empty(&state->enabled_tllis)) {
time_t age;
- struct gbproxy_tlli_info *tlli_info;
- tlli_info = llist_entry(state->enabled_tllis.prev,
- struct gbproxy_tlli_info,
+ struct gbproxy_link_info *link_info;
+ link_info = llist_entry(state->enabled_tllis.prev,
+ struct gbproxy_link_info,
list);
- age = now - tlli_info->timestamp;
+ age = now - link_info->timestamp;
/* age < 0 only happens after system time jumps, discard entry */
if (age <= peer->cfg->tlli_max_age && age >= 0) {
check_for_age = 0;
@@ -209,35 +209,35 @@ int gbproxy_remove_stale_tlli_infos(struct gbproxy_peer *peer, time_t now)
LOGP(DGPRS, LOGL_INFO,
"Removing TLLI %08x from list "
"(stale, age %d, max_age exceeded)\n",
- tlli_info->tlli.current, (int)age);
+ link_info->tlli.current, (int)age);
- gbproxy_delete_tlli_info(peer, tlli_info);
+ gbproxy_delete_link_info(peer, link_info);
deleted_count += 1;
}
return deleted_count;
}
-struct gbproxy_tlli_info *gbproxy_tlli_info_alloc( struct gbproxy_peer *peer)
+struct gbproxy_link_info *gbproxy_link_info_alloc( struct gbproxy_peer *peer)
{
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
- tlli_info = talloc_zero(peer, struct gbproxy_tlli_info);
- tlli_info->tlli.ptmsi = GSM_RESERVED_TMSI;
- tlli_info->sgsn_tlli.ptmsi = GSM_RESERVED_TMSI;
+ link_info = talloc_zero(peer, struct gbproxy_link_info);
+ link_info->tlli.ptmsi = GSM_RESERVED_TMSI;
+ link_info->sgsn_tlli.ptmsi = GSM_RESERVED_TMSI;
- INIT_LLIST_HEAD(&tlli_info->stored_msgs);
+ INIT_LLIST_HEAD(&link_info->stored_msgs);
- return tlli_info;
+ return link_info;
}
-void gbproxy_detach_tlli_info(
+void gbproxy_detach_link_info(
struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info)
+ struct gbproxy_link_info *link_info)
{
struct gbproxy_patch_state *state = &peer->patch_state;
- llist_del(&tlli_info->list);
+ llist_del(&link_info->list);
OSMO_ASSERT(state->enabled_tllis_count > 0);
state->enabled_tllis_count -= 1;
@@ -245,17 +245,17 @@ void gbproxy_detach_tlli_info(
state->enabled_tllis_count;
}
-void gbproxy_update_tlli_info(struct gbproxy_tlli_info *tlli_info,
+void gbproxy_update_link_info(struct gbproxy_link_info *link_info,
const uint8_t *imsi, size_t imsi_len)
{
if (!gprs_is_mi_imsi(imsi, imsi_len))
return;
- 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);
+ link_info->imsi_len = imsi_len;
+ link_info->imsi =
+ talloc_realloc_size(link_info, link_info->imsi, imsi_len);
+ OSMO_ASSERT(link_info->imsi != NULL);
+ memcpy(link_info->imsi, imsi, imsi_len);
}
void gbproxy_reassign_tlli(struct gbproxy_tlli_state *tlli_state,
@@ -275,16 +275,16 @@ void gbproxy_reassign_tlli(struct gbproxy_tlli_state *tlli_state,
}
uint32_t gbproxy_map_tlli(uint32_t other_tlli,
- struct gbproxy_tlli_info *tlli_info, int to_bss)
+ struct gbproxy_link_info *link_info, int to_bss)
{
uint32_t tlli = 0;
struct gbproxy_tlli_state *src, *dst;
if (to_bss) {
- src = &tlli_info->sgsn_tlli;
- dst = &tlli_info->tlli;
+ src = &link_info->sgsn_tlli;
+ dst = &link_info->tlli;
} else {
- src = &tlli_info->tlli;
- dst = &tlli_info->sgsn_tlli;
+ src = &link_info->tlli;
+ dst = &link_info->sgsn_tlli;
}
if (src->current == other_tlli)
tlli = dst->current;
@@ -326,78 +326,78 @@ static void gbproxy_validate_tlli(struct gbproxy_tlli_state *tlli_state,
tlli_state->assigned = 0;
}
-static void gbproxy_touch_tlli_info(struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info,
+static void gbproxy_touch_link_info(struct gbproxy_peer *peer,
+ struct gbproxy_link_info *link_info,
time_t now)
{
- gbproxy_detach_tlli_info(peer, tlli_info);
- gbproxy_attach_tlli_info(peer, now, tlli_info);
+ gbproxy_detach_link_info(peer, link_info);
+ gbproxy_attach_link_info(peer, now, link_info);
}
-static void gbproxy_unregister_tlli_info(struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info)
+static void gbproxy_unregister_link_info(struct gbproxy_peer *peer,
+ struct gbproxy_link_info *link_info)
{
- if (!tlli_info)
+ if (!link_info)
return;
- if (tlli_info->tlli.ptmsi == GSM_RESERVED_TMSI && !tlli_info->imsi_len) {
+ if (link_info->tlli.ptmsi == GSM_RESERVED_TMSI && !link_info->imsi_len) {
LOGP(DGPRS, LOGL_INFO,
"Removing TLLI %08x from list (P-TMSI or IMSI are not set)\n",
- tlli_info->tlli.current);
- gbproxy_delete_tlli_info(peer, tlli_info);
+ link_info->tlli.current);
+ gbproxy_delete_link_info(peer, link_info);
return;
}
- tlli_info->tlli.current = 0;
- tlli_info->tlli.assigned = 0;
- tlli_info->sgsn_tlli.current = 0;
- tlli_info->sgsn_tlli.assigned = 0;
+ link_info->tlli.current = 0;
+ link_info->tlli.assigned = 0;
+ link_info->sgsn_tlli.current = 0;
+ link_info->sgsn_tlli.assigned = 0;
- tlli_info->is_deregistered = 1;
+ link_info->is_deregistered = 1;
return;
}
int gbproxy_imsi_matches(struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info)
+ struct gbproxy_link_info *link_info)
{
if (!peer->cfg->check_imsi)
return 1;
- return tlli_info != NULL && tlli_info->imsi_matches;
+ return link_info != NULL && link_info->imsi_matches;
}
void gbproxy_assign_imsi(struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info,
+ struct gbproxy_link_info *link_info,
struct gprs_gb_parse_context *parse_ctx)
{
int imsi_matches;
- struct gbproxy_tlli_info *other_tlli_info;
+ struct gbproxy_link_info *other_link_info;
/* Make sure that there is a second entry with the same IMSI */
- other_tlli_info = gbproxy_tlli_info_by_imsi(
+ other_link_info = gbproxy_link_info_by_imsi(
peer, parse_ctx->imsi, parse_ctx->imsi_len);
- if (other_tlli_info && other_tlli_info != tlli_info) {
+ if (other_link_info && other_link_info != link_info) {
char mi_buf[200];
mi_buf[0] = '\0';
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
parse_ctx->imsi, parse_ctx->imsi_len);
LOGP(DGPRS, LOGL_INFO,
"Removing TLLI %08x from list (IMSI %s re-used)\n",
- other_tlli_info->tlli.current, mi_buf);
- gbproxy_delete_tlli_info(peer, other_tlli_info);
+ other_link_info->tlli.current, mi_buf);
+ gbproxy_delete_link_info(peer, other_link_info);
}
/* Update the IMSI field */
- gbproxy_update_tlli_info(tlli_info,
+ gbproxy_update_link_info(link_info,
parse_ctx->imsi, parse_ctx->imsi_len);
/* Check, whether the IMSI matches */
imsi_matches = gbproxy_check_imsi(peer, parse_ctx->imsi,
parse_ctx->imsi_len);
if (imsi_matches >= 0)
- tlli_info->imsi_matches = imsi_matches;
+ link_info->imsi_matches = imsi_matches;
}
static int gbproxy_tlli_match(const struct gbproxy_tlli_state *a,
@@ -415,43 +415,43 @@ static int gbproxy_tlli_match(const struct gbproxy_tlli_state *a,
return 0;
}
-static void gbproxy_remove_matching_tlli_infos(
- struct gbproxy_peer *peer, struct gbproxy_tlli_info *tlli_info)
+static void gbproxy_remove_matching_link_infos(
+ struct gbproxy_peer *peer, struct gbproxy_link_info *link_info)
{
- struct gbproxy_tlli_info *info, *nxt;
+ struct gbproxy_link_info *info, *nxt;
struct gbproxy_patch_state *state = &peer->patch_state;
/* Make sure that there is no second entry with the same P-TMSI or TLLI */
llist_for_each_entry_safe(info, nxt, &state->enabled_tllis, list) {
- if (info == tlli_info)
+ if (info == link_info)
continue;
- if (!gbproxy_tlli_match(&tlli_info->tlli, &info->tlli) &&
- (tlli_info->sgsn_nsei != info->sgsn_nsei ||
- !gbproxy_tlli_match(&tlli_info->sgsn_tlli, &info->sgsn_tlli)))
+ if (!gbproxy_tlli_match(&link_info->tlli, &info->tlli) &&
+ (link_info->sgsn_nsei != info->sgsn_nsei ||
+ !gbproxy_tlli_match(&link_info->sgsn_tlli, &info->sgsn_tlli)))
continue;
LOGP(DGPRS, LOGL_INFO,
"Removing TLLI %08x from list (P-TMSI/TLLI re-used)\n",
info->tlli.current);
- gbproxy_delete_tlli_info(peer, info);
+ gbproxy_delete_link_info(peer, info);
}
}
-struct gbproxy_tlli_info *gbproxy_get_tlli_info_ul(
+struct gbproxy_link_info *gbproxy_get_link_info_ul(
struct gbproxy_peer *peer,
struct gprs_gb_parse_context *parse_ctx)
{
- struct gbproxy_tlli_info *tlli_info = NULL;
+ struct gbproxy_link_info *link_info = NULL;
if (parse_ctx->tlli_enc)
- tlli_info = gbproxy_tlli_info_by_tlli(peer, parse_ctx->tlli);
+ link_info = gbproxy_link_info_by_tlli(peer, parse_ctx->tlli);
- if (!tlli_info && parse_ctx->imsi)
- tlli_info = gbproxy_tlli_info_by_imsi(
+ if (!link_info && parse_ctx->imsi)
+ link_info = gbproxy_link_info_by_imsi(
peer, parse_ctx->imsi, parse_ctx->imsi_len);
- if (!tlli_info && parse_ctx->ptmsi_enc && !parse_ctx->old_raid_is_foreign) {
+ if (!link_info && parse_ctx->ptmsi_enc && !parse_ctx->old_raid_is_foreign) {
uint32_t bss_ptmsi;
if (!gprs_parse_mi_tmsi(parse_ctx->ptmsi_enc, GSM48_TMSI_LEN,
&bss_ptmsi))
@@ -459,78 +459,78 @@ struct gbproxy_tlli_info *gbproxy_get_tlli_info_ul(
"Failed to parse P-TMSI (TLLI is %08x)\n",
parse_ctx->tlli);
else
- tlli_info = gbproxy_tlli_info_by_ptmsi(peer, bss_ptmsi);
+ link_info = gbproxy_link_info_by_ptmsi(peer, bss_ptmsi);
}
- if (tlli_info)
- tlli_info->is_deregistered = 0;
+ if (link_info)
+ link_info->is_deregistered = 0;
- return tlli_info;
+ return link_info;
}
-struct gbproxy_tlli_info *gbproxy_update_tlli_state_ul(
+struct gbproxy_link_info *gbproxy_update_link_state_ul(
struct gbproxy_peer *peer,
time_t now,
struct gprs_gb_parse_context *parse_ctx)
{
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
- tlli_info = gbproxy_get_tlli_info_ul(peer, parse_ctx);
+ link_info = gbproxy_get_link_info_ul(peer, parse_ctx);
if (parse_ctx->tlli_enc && parse_ctx->llc) {
uint32_t sgsn_tlli;
- if (!tlli_info) {
+ if (!link_info) {
LOGP(DGPRS, LOGL_INFO, "Adding TLLI %08x to list\n",
parse_ctx->tlli);
- tlli_info = gbproxy_tlli_info_alloc(peer);
- gbproxy_attach_tlli_info(peer, now, tlli_info);
+ link_info = gbproxy_link_info_alloc(peer);
+ gbproxy_attach_link_info(peer, now, link_info);
/* Setup TLLIs */
- sgsn_tlli = gbproxy_make_sgsn_tlli(peer, tlli_info,
+ sgsn_tlli = gbproxy_make_sgsn_tlli(peer, link_info,
parse_ctx->tlli);
- tlli_info->sgsn_tlli.current = sgsn_tlli;
- tlli_info->tlli.current = parse_ctx->tlli;;
- } else if (!tlli_info->tlli.current) {
+ link_info->sgsn_tlli.current = sgsn_tlli;
+ link_info->tlli.current = parse_ctx->tlli;;
+ } else if (!link_info->tlli.current) {
/* New TLLI (info found by IMSI or P-TMSI) */
- tlli_info->tlli.current = parse_ctx->tlli;
- tlli_info->sgsn_tlli.current =
- gbproxy_make_sgsn_tlli(peer, tlli_info,
+ link_info->tlli.current = parse_ctx->tlli;
+ link_info->sgsn_tlli.current =
+ gbproxy_make_sgsn_tlli(peer, link_info,
parse_ctx->tlli);
- gbproxy_touch_tlli_info(peer, tlli_info, now);
+ gbproxy_touch_link_info(peer, link_info, now);
} else {
- sgsn_tlli = gbproxy_map_tlli(parse_ctx->tlli, tlli_info, 0);
+ sgsn_tlli = gbproxy_map_tlli(parse_ctx->tlli, link_info, 0);
if (!sgsn_tlli)
- sgsn_tlli = gbproxy_make_sgsn_tlli(peer, tlli_info,
+ sgsn_tlli = gbproxy_make_sgsn_tlli(peer, link_info,
parse_ctx->tlli);
- gbproxy_validate_tlli(&tlli_info->tlli,
+ gbproxy_validate_tlli(&link_info->tlli,
parse_ctx->tlli, 0);
- gbproxy_validate_tlli(&tlli_info->sgsn_tlli,
+ gbproxy_validate_tlli(&link_info->sgsn_tlli,
sgsn_tlli, 0);
- gbproxy_touch_tlli_info(peer, tlli_info, now);
+ gbproxy_touch_link_info(peer, link_info, now);
}
- } else if (tlli_info) {
- gbproxy_touch_tlli_info(peer, tlli_info, now);
+ } else if (link_info) {
+ gbproxy_touch_link_info(peer, link_info, now);
}
- if (parse_ctx->imsi && tlli_info && tlli_info->imsi_len == 0)
- gbproxy_assign_imsi(peer, tlli_info, parse_ctx);
+ if (parse_ctx->imsi && link_info && link_info->imsi_len == 0)
+ gbproxy_assign_imsi(peer, link_info, parse_ctx);
- return tlli_info;
+ return link_info;
}
-struct gbproxy_tlli_info *gbproxy_update_tlli_state_dl(
+struct gbproxy_link_info *gbproxy_update_link_state_dl(
struct gbproxy_peer *peer,
time_t now,
struct gprs_gb_parse_context *parse_ctx)
{
- struct gbproxy_tlli_info *tlli_info = NULL;
+ struct gbproxy_link_info *link_info = NULL;
if (parse_ctx->tlli_enc)
- tlli_info = gbproxy_tlli_info_by_sgsn_tlli(
+ link_info = gbproxy_link_info_by_sgsn_tlli(
peer, parse_ctx->tlli, parse_ctx->peer_nsei);
- if (parse_ctx->tlli_enc && parse_ctx->new_ptmsi_enc && tlli_info) {
+ if (parse_ctx->tlli_enc && parse_ctx->new_ptmsi_enc && link_info) {
/* A new P-TMSI has been signalled in the message,
* register new TLLI */
uint32_t new_sgsn_ptmsi;
@@ -540,7 +540,7 @@ struct gbproxy_tlli_info *gbproxy_update_tlli_state_dl(
LOGP(DGPRS, LOGL_ERROR,
"Failed to parse new TLLI/PTMSI (current is %08x)\n",
parse_ctx->tlli);
- return tlli_info;
+ return link_info;
}
new_bss_ptmsi = gbproxy_make_bss_ptmsi(peer, new_sgsn_ptmsi);
@@ -548,12 +548,12 @@ struct gbproxy_tlli_info *gbproxy_update_tlli_state_dl(
"Got new PTMSI %08x from SGSN, using %08x for BSS\n",
new_sgsn_ptmsi, new_bss_ptmsi);
/* Setup PTMSIs */
- tlli_info->sgsn_tlli.ptmsi = new_sgsn_ptmsi;
- tlli_info->tlli.ptmsi = new_bss_ptmsi;
- } else if (parse_ctx->tlli_enc && parse_ctx->new_ptmsi_enc && !tlli_info &&
+ link_info->sgsn_tlli.ptmsi = new_sgsn_ptmsi;
+ link_info->tlli.ptmsi = new_bss_ptmsi;
+ } else if (parse_ctx->tlli_enc && parse_ctx->new_ptmsi_enc && !link_info &&
!peer->cfg->patch_ptmsi) {
/* A new P-TMSI has been signalled in the message with an unknown
- * TLLI, create a new tlli_info */
+ * TLLI, create a new link_info */
/* TODO: Add a test case for this branch */
uint32_t new_ptmsi;
if (!gprs_parse_mi_tmsi(parse_ctx->new_ptmsi_enc, GSM48_TMSI_LEN,
@@ -561,35 +561,35 @@ struct gbproxy_tlli_info *gbproxy_update_tlli_state_dl(
LOGP(DGPRS, LOGL_ERROR,
"Failed to parse new PTMSI (TLLI is %08x)\n",
parse_ctx->tlli);
- return tlli_info;
+ return link_info;
}
LOGP(DGPRS, LOGL_INFO,
"Adding TLLI %08x to list (SGSN, new P-TMSI is %08x)\n",
parse_ctx->tlli, new_ptmsi);
- tlli_info = gbproxy_tlli_info_alloc(peer);
- tlli_info->sgsn_tlli.current = parse_ctx->tlli;;
- tlli_info->tlli.current = parse_ctx->tlli;;
- tlli_info->sgsn_tlli.ptmsi = new_ptmsi;
- tlli_info->tlli.ptmsi = new_ptmsi;
- gbproxy_attach_tlli_info(peer, now, tlli_info);
- } else if (parse_ctx->tlli_enc && parse_ctx->llc && !tlli_info &&
+ link_info = gbproxy_link_info_alloc(peer);
+ link_info->sgsn_tlli.current = parse_ctx->tlli;;
+ link_info->tlli.current = parse_ctx->tlli;;
+ link_info->sgsn_tlli.ptmsi = new_ptmsi;
+ link_info->tlli.ptmsi = new_ptmsi;
+ gbproxy_attach_link_info(peer, now, link_info);
+ } else if (parse_ctx->tlli_enc && parse_ctx->llc && !link_info &&
!peer->cfg->patch_ptmsi) {
- /* Unknown SGSN TLLI, create a new tlli_info */
+ /* Unknown SGSN TLLI, create a new link_info */
uint32_t new_ptmsi;
- tlli_info = gbproxy_tlli_info_alloc(peer);
+ link_info = gbproxy_link_info_alloc(peer);
LOGP(DGPRS, LOGL_INFO, "Adding TLLI %08x to list (SGSN)\n",
parse_ctx->tlli);
- gbproxy_attach_tlli_info(peer, now, tlli_info);
+ gbproxy_attach_link_info(peer, now, link_info);
/* Setup TLLIs */
- tlli_info->sgsn_tlli.current = parse_ctx->tlli;
- tlli_info->tlli.current = parse_ctx->tlli;
+ link_info->sgsn_tlli.current = parse_ctx->tlli;
+ link_info->tlli.current = parse_ctx->tlli;
if (!parse_ctx->new_ptmsi_enc)
- return tlli_info;
+ return link_info;
/* A new P-TMSI has been signalled in the message */
if (!gprs_parse_mi_tmsi(parse_ctx->new_ptmsi_enc,
@@ -597,57 +597,57 @@ struct gbproxy_tlli_info *gbproxy_update_tlli_state_dl(
LOGP(DGPRS, LOGL_ERROR,
"Failed to parse new PTMSI (TLLI is %08x)\n",
parse_ctx->tlli);
- return tlli_info;
+ return link_info;
}
LOGP(DGPRS, LOGL_INFO,
"Assigning new P-TMSI %08x\n", new_ptmsi);
/* Setup P-TMSIs */
- tlli_info->sgsn_tlli.ptmsi = new_ptmsi;
- tlli_info->tlli.ptmsi = new_ptmsi;
- } else if (parse_ctx->tlli_enc && parse_ctx->llc && tlli_info) {
+ link_info->sgsn_tlli.ptmsi = new_ptmsi;
+ link_info->tlli.ptmsi = new_ptmsi;
+ } else if (parse_ctx->tlli_enc && parse_ctx->llc && link_info) {
uint32_t bss_tlli = gbproxy_map_tlli(parse_ctx->tlli,
- tlli_info, 1);
- gbproxy_validate_tlli(&tlli_info->sgsn_tlli, parse_ctx->tlli, 1);
- gbproxy_validate_tlli(&tlli_info->tlli, bss_tlli, 1);
- gbproxy_touch_tlli_info(peer, tlli_info, now);
- } else if (tlli_info) {
- gbproxy_touch_tlli_info(peer, tlli_info, now);
+ link_info, 1);
+ gbproxy_validate_tlli(&link_info->sgsn_tlli, parse_ctx->tlli, 1);
+ gbproxy_validate_tlli(&link_info->tlli, bss_tlli, 1);
+ gbproxy_touch_link_info(peer, link_info, now);
+ } else if (link_info) {
+ gbproxy_touch_link_info(peer, link_info, now);
}
- if (parse_ctx->imsi && tlli_info && tlli_info->imsi_len == 0)
- gbproxy_assign_imsi(peer, tlli_info, parse_ctx);
+ if (parse_ctx->imsi && link_info && link_info->imsi_len == 0)
+ gbproxy_assign_imsi(peer, link_info, parse_ctx);
- return tlli_info;
+ return link_info;
}
-void gbproxy_update_tlli_state_after(
+void gbproxy_update_link_state_after(
struct gbproxy_peer *peer,
- struct gbproxy_tlli_info *tlli_info,
+ struct gbproxy_link_info *link_info,
time_t now,
struct gprs_gb_parse_context *parse_ctx)
{
- if (parse_ctx->invalidate_tlli && tlli_info) {
+ if (parse_ctx->invalidate_tlli && link_info) {
int keep_info =
- peer->cfg->keep_tlli_infos == GBPROX_KEEP_ALWAYS ||
- (peer->cfg->keep_tlli_infos == GBPROX_KEEP_REATTACH &&
+ peer->cfg->keep_link_infos == GBPROX_KEEP_ALWAYS ||
+ (peer->cfg->keep_link_infos == GBPROX_KEEP_REATTACH &&
parse_ctx->await_reattach) ||
- (peer->cfg->keep_tlli_infos == GBPROX_KEEP_IDENTIFIED &&
- tlli_info->imsi_len > 0);
+ (peer->cfg->keep_link_infos == GBPROX_KEEP_IDENTIFIED &&
+ link_info->imsi_len > 0);
if (keep_info) {
LOGP(DGPRS, LOGL_INFO, "Unregistering TLLI %08x\n",
- tlli_info->tlli.current);
- gbproxy_unregister_tlli_info(peer, tlli_info);
+ link_info->tlli.current);
+ gbproxy_unregister_link_info(peer, link_info);
} else {
LOGP(DGPRS, LOGL_INFO, "Removing TLLI %08x from list\n",
- tlli_info->tlli.current);
- gbproxy_delete_tlli_info(peer, tlli_info);
+ link_info->tlli.current);
+ gbproxy_delete_link_info(peer, link_info);
}
} else if (parse_ctx->to_bss && parse_ctx->tlli_enc &&
- parse_ctx->new_ptmsi_enc && tlli_info) {
+ parse_ctx->new_ptmsi_enc && link_info) {
/* A new PTMSI has been signaled in the message,
* register new TLLI */
- uint32_t new_sgsn_ptmsi = tlli_info->sgsn_tlli.ptmsi;
- uint32_t new_bss_ptmsi = tlli_info->tlli.ptmsi;
+ uint32_t new_sgsn_ptmsi = link_info->sgsn_tlli.ptmsi;
+ uint32_t new_bss_ptmsi = link_info->tlli.ptmsi;
uint32_t new_sgsn_tlli;
uint32_t new_bss_tlli = 0;
@@ -658,14 +658,14 @@ void gbproxy_update_tlli_state_after(
"Assigning new TLLI %08x to SGSN, %08x to BSS\n",
new_sgsn_tlli, new_bss_tlli);
- gbproxy_reassign_tlli(&tlli_info->sgsn_tlli,
+ gbproxy_reassign_tlli(&link_info->sgsn_tlli,
peer, new_sgsn_tlli);
- gbproxy_reassign_tlli(&tlli_info->tlli,
+ gbproxy_reassign_tlli(&link_info->tlli,
peer, new_bss_tlli);
- gbproxy_remove_matching_tlli_infos(peer, tlli_info);
+ gbproxy_remove_matching_link_infos(peer, link_info);
}
- gbproxy_remove_stale_tlli_infos(peer, now);
+ gbproxy_remove_stale_link_infos(peer, now);
}
diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c
index 72469da21..313cd9b3d 100644
--- a/openbsc/src/gprs/gb_proxy_vty.c
+++ b/openbsc/src/gprs/gb_proxy_vty.c
@@ -115,7 +115,7 @@ static int config_write_gbproxy(struct vty *vty)
vty_out(vty, " tlli-list max-length %d%s",
g_cfg->tlli_max_len, VTY_NEWLINE);
vty_out(vty, " tlli-list keep-mode %s%s",
- get_value_string(keep_modes, g_cfg->keep_tlli_infos),
+ get_value_string(keep_modes, g_cfg->keep_link_infos),
VTY_NEWLINE);
@@ -421,7 +421,7 @@ DEFUN(cfg_gbproxy_tlli_list_keep_mode,
{
int val = get_string_value(keep_modes, argv[0]);
OSMO_ASSERT(val >= GBPROX_KEEP_NEVER && val <= GBPROX_KEEP_ALWAYS);
- g_cfg->keep_tlli_infos = val;
+ g_cfg->keep_link_infos = val;
return CMD_SUCCESS;
}
@@ -453,37 +453,37 @@ DEFUN(show_gbproxy_tllis, show_gbproxy_tllis_cmd, "show gbproxy tllis",
time_t now = time(NULL);
llist_for_each_entry(peer, &g_cfg->bts_peers, list) {
- struct gbproxy_tlli_info *tlli_info;
+ struct gbproxy_link_info *link_info;
struct gbproxy_patch_state *state = &peer->patch_state;
gbprox_vty_print_peer(vty, peer);
- llist_for_each_entry(tlli_info, &state->enabled_tllis, list) {
- time_t age = now - tlli_info->timestamp;
+ llist_for_each_entry(link_info, &state->enabled_tllis, list) {
+ time_t age = now - link_info->timestamp;
int stored_msgs = 0;
struct llist_head *iter;
- llist_for_each(iter, &tlli_info->stored_msgs)
+ llist_for_each(iter, &link_info->stored_msgs)
stored_msgs++;
- if (tlli_info->imsi > 0) {
+ if (link_info->imsi > 0) {
snprintf(mi_buf, sizeof(mi_buf), "(invalid)");
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
- tlli_info->imsi,
- tlli_info->imsi_len);
+ link_info->imsi,
+ link_info->imsi_len);
} else {
snprintf(mi_buf, sizeof(mi_buf), "(none)");
}
vty_out(vty, " TLLI %08x, IMSI %s, AGE %d",
- tlli_info->tlli.current, mi_buf, (int)age);
+ link_info->tlli.current, mi_buf, (int)age);
if (stored_msgs)
vty_out(vty, ", STORED %d", stored_msgs);
if (g_cfg->route_to_sgsn2)
vty_out(vty, ", SGSN NSEI %d",
- tlli_info->sgsn_nsei);
+ link_info->sgsn_nsei);
- if (tlli_info->is_deregistered)
+ if (link_info->is_deregistered)
vty_out(vty, ", DE-REGISTERED");
vty_out(vty, "%s", VTY_NEWLINE);
@@ -598,7 +598,7 @@ DEFUN(delete_gb_tlli_by_id, delete_gb_tlli_by_id_cmd,
uint32_t ident = 0;
const char *imsi = NULL;
struct gbproxy_peer *peer = 0;
- struct gbproxy_tlli_info *tlli_info, *nxt;
+ struct gbproxy_link_info *link_info, *nxt;
struct gbproxy_patch_state *state;
char mi_buf[200];
int found = 0;
@@ -620,30 +620,30 @@ DEFUN(delete_gb_tlli_by_id, delete_gb_tlli_by_id_cmd,
state = &peer->patch_state;
- llist_for_each_entry_safe(tlli_info, nxt, &state->enabled_tllis, list) {
+ llist_for_each_entry_safe(link_info, nxt, &state->enabled_tllis, list) {
switch (match) {
case MATCH_TLLI:
- if (tlli_info->tlli.current != ident)
+ if (link_info->tlli.current != ident)
continue;
break;
case MATCH_SGSN:
- if (tlli_info->sgsn_nsei != ident)
+ if (link_info->sgsn_nsei != ident)
continue;
break;
case MATCH_IMSI:
mi_buf[0] = '\0';
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
- tlli_info->imsi,
- tlli_info->imsi_len);
+ link_info->imsi,
+ link_info->imsi_len);
if (strcmp(mi_buf, imsi) != 0)
continue;
break;
}
- vty_out(vty, "Deleting TLLI %08x%s", tlli_info->tlli.current,
+ vty_out(vty, "Deleting TLLI %08x%s", link_info->tlli.current,
VTY_NEWLINE);
- gbproxy_delete_tlli_info(peer, tlli_info);
+ gbproxy_delete_link_info(peer, link_info);
found += 1;
}
@@ -664,7 +664,7 @@ DEFUN(delete_gb_tlli, delete_gb_tlli_cmd,
const uint16_t nsei = atoi(argv[0]);
enum {MATCH_STALE = 's', MATCH_DEREGISTERED = 'd'} match;
struct gbproxy_peer *peer = 0;
- struct gbproxy_tlli_info *tlli_info, *nxt;
+ struct gbproxy_link_info *link_info, *nxt;
struct gbproxy_patch_state *state;
int found = 0;
@@ -680,17 +680,17 @@ DEFUN(delete_gb_tlli, delete_gb_tlli_cmd,
state = &peer->patch_state;
if (match == MATCH_STALE) {
- found = gbproxy_remove_stale_tlli_infos(peer, time(NULL));
+ found = gbproxy_remove_stale_link_infos(peer, time(NULL));
if (found)
vty_out(vty, "Deleted %d stale TLLI%s%s",
found, found == 1 ? "" : "s", VTY_NEWLINE);
} else {
- llist_for_each_entry_safe(tlli_info, nxt,
+ llist_for_each_entry_safe(link_info, nxt,
&state->enabled_tllis, list) {
- if (!tlli_info->is_deregistered)
+ if (!link_info->is_deregistered)
continue;
- gbproxy_delete_tlli_info(peer, tlli_info);
+ gbproxy_delete_link_info(peer, link_info);
found += 1;
}
}