aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-ganc/ganc_server.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-07-13 22:55:27 +0200
committerHarald Welte <laforge@gnumonks.org>2015-11-15 14:15:19 +0100
commit6682f4bb80d2e52620d73d9bf8ced02a9d917397 (patch)
tree11d7b52f072a4a800b7f08c69808e2456f48596b /openbsc/src/osmo-ganc/ganc_server.c
parent768bbc846e88352cf682f42f4863e4996e22d44c (diff)
ganc: Store more data (GERAN LAC, MAC addr, ESSID, ...) of peer
We store more of the data sent by the MS during REGISTER, and show that data during 'show gan-peer'. Also, there is now a table view (show gan-peer) as well as a detailed view (show gan-peer details)
Diffstat (limited to 'openbsc/src/osmo-ganc/ganc_server.c')
-rw-r--r--openbsc/src/osmo-ganc/ganc_server.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/openbsc/src/osmo-ganc/ganc_server.c b/openbsc/src/osmo-ganc/ganc_server.c
index 675d3b330..9bb786e30 100644
--- a/openbsc/src/osmo-ganc/ganc_server.c
+++ b/openbsc/src/osmo-ganc/ganc_server.c
@@ -333,6 +333,8 @@ static int rx_rc_discovery_req(struct gan_peer *peer, struct msgb *msg,
static int rx_rc_register_req(struct gan_peer *peer, struct msgb *msg,
struct tlv_parsed *tp)
{
+ uint8_t *cur;
+
if (TLVP_PRESENT(tp, GA_IE_MI)) {
struct gan_peer *stale_peer;
char imsi[sizeof(peer->imsi)];
@@ -355,6 +357,44 @@ static int rx_rc_register_req(struct gan_peer *peer, struct msgb *msg,
peer->gan_release = *TLVP_VAL(tp, GA_IE_GAN_RELEASE_IND);
if (TLVP_PRESENT(tp, GA_IE_GAN_CM) && TLVP_LEN(tp, GA_IE_GAN_CM) >=2)
memcpy(peer->gan_classmark, TLVP_VAL(tp, GA_IE_GAN_CM), 2);
+ if (TLVP_PRESENT(tp, GA_IE_RADIO_IE) &&
+ TLVP_LEN(tp, GA_IE_RADIO_IE) >= 7 &&
+ (*TLVP_VAL(tp, GA_IE_RADIO_IE) & 0x0F) == 0x00) {
+ if (peer->ms_radio_id)
+ talloc_free(peer->ms_radio_id);
+ peer->ap_radio_id = talloc_memdup(peer,
+ TLVP_VAL(tp, GA_IE_RADIO_IE)+1,
+ TLVP_LEN(tp, GA_IE_RADIO_IE)-1);
+ }
+ if (TLVP_PRESENT(tp, GA_IE_MS_RADIO_ID) &&
+ TLVP_LEN(tp, GA_IE_MS_RADIO_ID) >= 7 &&
+ (*TLVP_VAL(tp, GA_IE_MS_RADIO_ID) & 0x0F) == 0x00) {
+ if (peer->ms_radio_id)
+ talloc_free(peer->ms_radio_id);
+ peer->ms_radio_id = talloc_memdup(peer,
+ TLVP_VAL(tp, GA_IE_MS_RADIO_ID)+1,
+ TLVP_LEN(tp, GA_IE_MS_RADIO_ID)-1);
+ }
+ if (TLVP_PRESENT(tp, GA_IE_AP_SERV_NAME) &&
+ TLVP_LEN(tp, GA_IE_AP_SERV_NAME) >= 1) {
+ if (peer->ap_serv_name)
+ talloc_free(peer->ap_serv_name);
+ /* strndup copies len bytes + adds zero */
+ peer->ap_serv_name = talloc_strndup(peer,
+ TLVP_VAL(tp, GA_IE_AP_SERV_NAME)+1,
+ TLVP_LEN(tp, GA_IE_AP_SERV_NAME)-1);
+ }
+ if (TLVP_PRESENT(tp, GA_IE_LAC) && TLVP_LEN(tp, GA_IE_LAC) >= 5) {
+ struct gsm48_loc_area_id *lai;
+ lai = TLVP_VAL(tp, GA_IE_LAC);
+ gsm48_decode_lai(lai, &peer->ra_id.mcc, &peer->ra_id.mnc,
+ &peer->ra_id.lac);
+ }
+ if (TLVP_PRESENT(tp, GA_IE_RAC) && TLVP_LEN(tp, GA_IE_RAC) >= 2)
+ peer->ra_id.rac = ntohs(TLVP_VAL(tp, GA_IE_RAC));
+ if (TLVP_PRESENT(tp, GA_IE_GERAN_CELL_ID) &&
+ TLVP_LEN(tp, GA_IE_GERAN_CELL_ID) >= 2)
+ peer->cell_id = ntohs(*(uint16_t *)TLVP_VAL(tp, GA_IE_GERAN_CELL_ID));
peer->flags |= GAN_PF_REGISTERED;
peer->bts = select_bts(peer);