aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-21 00:38:05 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-03-11 00:45:49 +0100
commit02d1fe87f0fdf4d9e08cde9f727f00e17343c20c (patch)
treecfe3f9d74d2b24735fcee66cd2ef4b465c7a2fe3 /src
parent29cd7a84089b4a29748a0c9723f539bc6005ad99 (diff)
implement support for 3-digit MNC with leading zeros
Record the mnc_3_digits flag from SI and pass on via the PCU interface. Instead of changing to e.g. osmo_plmn_id, add the flag separately, and instead of bool use a uint8_t, to not raise any struct packing issues and clarify the flag's size beyond any doubt. Bump the PCU interface version to 9. This is one part of the three identical pcuif_proto.h patches: - I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts) - I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu) - I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc) Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore) Change-Id: I49cd762c3c9d7ee6a82451bdf3ffa2a060767947
Diffstat (limited to 'src')
-rw-r--r--src/common/pcu_sock.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 0f4c0531..949a5faa 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -34,6 +34,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/select.h>
#include <osmocom/core/socket.h>
+#include <osmocom/gsm/gsm23003.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/pcu_if.h>
@@ -143,8 +144,9 @@ int pcu_tx_info_ind(void)
info_ind->flags |= PCU_IF_FLAG_SYSMO;
/* RAI */
- info_ind->mcc = net->mcc;
- info_ind->mnc = net->mnc;
+ info_ind->mcc = net->plmn.mcc;
+ info_ind->mnc = net->plmn.mnc;
+ info_ind->mnc_3_digits = net->plmn.mnc_3_digits;
info_ind->lac = bts->location_area_code;
info_ind->rac = bts->gprs.rac;
@@ -254,14 +256,7 @@ static int pcu_if_signal_cb(unsigned int subsys, unsigned int signal,
break;
si3 = (struct gsm48_system_information_type_3 *)
bts->si_buf[SYSINFO_TYPE_3];
- net->mcc = ((si3->lai.digits[0] & 0x0f) << 8)
- | (si3->lai.digits[0] & 0xf0)
- | (si3->lai.digits[1] & 0x0f);
- net->mnc = ((si3->lai.digits[2] & 0x0f) << 8)
- | (si3->lai.digits[2] & 0xf0)
- | ((si3->lai.digits[1] & 0xf0) >> 4);
- if ((net->mnc & 0x00f) == 0x00f)
- net->mnc >>= 4;
+ osmo_plmn_from_bcd(si3->lai.digits, &net->plmn);
bts->location_area_code = ntohs(si3->lai.lac);
bts->cell_identity = si3->cell_identity;
avail_lai = 1;