aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gb_proxy.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-12 00:07:29 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-12 00:07:29 +0200
commit1174c08068c4775da740da806bcd3e41f09fee66 (patch)
tree6f35d6f2602ea687d88c9b9c307c56af347d897d /openbsc/src/gprs/gb_proxy.c
parent615e95632850854ca587126905474c6dedd8298e (diff)
[gprs] gb_proxy: Snoop Cell ID from BSSGP RESET
If a PTP BVC is BVC-RESET by the BSS, the PDU contains the Cell Identifier. We can snoop this into our gbprox_peer structure for better visualization of each peer in they vty.
Diffstat (limited to 'openbsc/src/gprs/gb_proxy.c')
-rw-r--r--openbsc/src/gprs/gb_proxy.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index fd932523b..fe299c512 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -82,7 +82,7 @@ static struct gbprox_peer *peer_by_rac(const uint8_t *ra)
{
struct gbprox_peer *peer;
llist_for_each_entry(peer, &gbprox_bts_peers, list) {
- if (!memcmp(&peer->ra, ra, 6))
+ if (!memcmp(peer->ra, ra, 6))
return peer;
}
return NULL;
@@ -93,7 +93,7 @@ static struct gbprox_peer *peer_by_lac(const uint8_t *la)
{
struct gbprox_peer *peer;
llist_for_each_entry(peer, &gbprox_bts_peers, list) {
- if (!memcmp(&peer->ra, la, 5))
+ if (!memcmp(peer->ra, la, 5))
return peer;
}
return NULL;
@@ -213,8 +213,8 @@ static int gbprox_rx_sig_from_bss(struct msgb *msg, struct gprs_nsvc *nsvc,
from_peer = peer_by_nsvc(nsvc);
if (!from_peer)
goto err_no_peer;
- memcpy(&from_peer->ra, TLVP_VAL(&tp, BSSGP_IE_ROUTEING_AREA),
- sizeof(&from_peer->ra));
+ memcpy(from_peer->ra, TLVP_VAL(&tp, BSSGP_IE_ROUTEING_AREA),
+ sizeof(from_peer->ra));
gsm48_parse_ra(&raid, from_peer->ra);
DEBUGP(DGPRS, "NSEI=%u RAC snooping: RAC %u/%u/%u/%u behind BVCI=%u, "
"NSVCI=%u\n", nsvc->nsei, raid.mcc, raid.mnc, raid.lac,
@@ -235,7 +235,9 @@ static int gbprox_rx_sig_from_bss(struct msgb *msg, struct gprs_nsvc *nsvc,
"BVC RESET ACK of BVCI=0\n", nsvc->nsei);
return bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK,
nsvc->nsei, 0, ns_bvci);
- } else if (!peer_by_bvci(bvci)) {
+ }
+ from_peer = peer_by_bvci(bvci);
+ if (!from_peer) {
/* if a PTP-BVC is reset, and we don't know that
* PTP-BVCI yet, we should allocate a new peer */
LOGP(DGPRS, LOGL_INFO, "Allocationg new peer for "
@@ -244,6 +246,21 @@ static int gbprox_rx_sig_from_bss(struct msgb *msg, struct gprs_nsvc *nsvc,
from_peer = peer_alloc(bvci);
from_peer->nsvc = nsvc;
}
+ if (TLVP_PRESENT(&tp, BSSGP_IE_CELL_ID)) {
+ struct gprs_ra_id raid;
+ /* We have a Cell Identifier present in this
+ * PDU, this means we can extend our local
+ * state information about this particular cell
+ * */
+ memcpy(from_peer->ra,
+ TLVP_VAL(&tp, BSSGP_IE_CELL_ID),
+ sizeof(from_peer->ra));
+ gsm48_parse_ra(&raid, from_peer->ra);
+ LOGP(DGPRS, LOGL_INFO, "NSEI=%u/BVCI=%u "
+ "Cell ID " "%u-%u-%u-%u\n", nsvc->nsei,
+ bvci, raid.mcc, raid.mnc, raid.lac,
+ raid.rac);
+ }
}
break;
}