implement support for 3-digit MNC with leading zeros
Receive the mnc_3_digits flag from the PCU interface.
Bump the PCU interface to 9.
This is one part of the three identical pcuif_proto.h patches:
- I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts)
- I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu)
- I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc)
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).
Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore),
Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore)
Change-Id: I787fed84a7b613158a5618dd5cffafe4e4927234
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 3cc86e2..6727735 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -44,6 +44,7 @@
extern void *tall_pcu_ctx;
extern uint16_t spoof_mcc, spoof_mnc;
+extern bool spoof_mnc_3_digits;
static void bvc_timeout(void *_priv);
@@ -876,16 +877,12 @@
struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts,
uint16_t local_port, uint32_t sgsn_ip,
uint16_t sgsn_port, uint16_t nsei, uint16_t nsvci, uint16_t bvci,
- uint16_t mcc, uint16_t mnc, uint16_t lac, uint16_t rac,
+ uint16_t mcc, uint16_t mnc, bool mnc_3_digits, uint16_t lac, uint16_t rac,
uint16_t cell_id)
{
struct sockaddr_in dest;
int rc;
- mcc = ((mcc & 0xf00) >> 8) * 100 + ((mcc & 0x0f0) >> 4) * 10 + (mcc & 0x00f);
- mnc = ((mnc & 0xf00) >> 8) * 100 + ((mnc & 0x0f0) >> 4) * 10 + (mnc & 0x00f);
- cell_id = ntohs(cell_id);
-
/* if already created... return the current address */
if (the_pcu.bctx)
return &the_pcu;
@@ -930,7 +927,13 @@
return NULL;
}
the_pcu.bctx->ra_id.mcc = spoof_mcc ? : mcc;
- the_pcu.bctx->ra_id.mnc = spoof_mnc ? : mnc;
+ if (spoof_mnc) {
+ the_pcu.bctx->ra_id.mnc = spoof_mnc;
+ the_pcu.bctx->ra_id.mnc_3_digits = spoof_mnc_3_digits;
+ } else {
+ the_pcu.bctx->ra_id.mnc = mnc;
+ the_pcu.bctx->ra_id.mnc_3_digits = mnc_3_digits;
+ }
the_pcu.bctx->ra_id.lac = lac;
the_pcu.bctx->ra_id.rac = rac;
the_pcu.bctx->cell_id = cell_id;