gprs/test: Rearrange for PTMSI parsing
Add TLLI cache output to gbprox_dump_peers() to include this info
into the test output.
Separate RA Update Req message handling from Attach Request handling.
Note: There is no test case for the P-TMSI Reallocation Command yet.
Sponsored-by: On-Waves ehf
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index 88f727e..00acb62 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -1845,12 +1845,15 @@
unsigned int i;
const struct rate_ctr_group_desc *desc;
int rc;
+ time_t now = time(NULL);
rc = fprintf(stream, "%*sPeers:\n", indent, "");
if (rc < 0)
return rc;
llist_for_each_entry(peer, &gbprox_bts_peers, list) {
+ struct gbprox_tlli_info *tlli_info;
+ struct gbprox_patch_state *state = &peer->patch_state;
gsm48_parse_ra(&raid, peer->ra);
rc = fprintf(stream, "%*s NSEI %u, BVCI %u, %sblocked, "
@@ -1877,6 +1880,23 @@
return rc;
}
}
+
+ fprintf(stream, "%*s TLLI-Cache: %d\n",
+ indent, "", state->enabled_tllis_count);
+ llist_for_each_entry(tlli_info, &state->enabled_tllis, list) {
+ char mi_buf[200];
+ time_t age = now - tlli_info->timestamp;
+ 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);
+ rc = fprintf(stream,
+ "%*s TLLI %08x, IMSI %s, AGE %d\n",
+ indent, "",
+ tlli_info->tlli, mi_buf, (int)age);
+ if (rc < 0)
+ return rc;
+ }
}
return 0;