implement support for 3-digit MNC with leading zeros
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).
Note that in gbproxy_test.ok, 0-0 changes to 000-000 instead of 000-00, because
the parsed ra buffer is 000000 which results in 000-000, while 00f000 would
result in 000-00. IOW this is expected.
Change-Id: I7437dfaa586689e2bef0d4be6537e5577a8f6c26
diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c
index 080c96b..8edb171 100644
--- a/tests/gbproxy/gbproxy_test.c
+++ b/tests/gbproxy/gbproxy_test.c
@@ -131,12 +131,11 @@
struct gbproxy_patch_state *state = &peer->patch_state;
gsm48_parse_ra(&raid, peer->ra);
- rc = fprintf(stream, "%*s NSEI %u, BVCI %u, %sblocked, "
- "RAI %u-%u-%u-%u\n",
+ rc = fprintf(stream, "%*s NSEI %u, BVCI %u, %sblocked, RAI %s\n",
indent, "",
peer->nsei, peer->bvci,
peer->blocked ? "" : "not ",
- raid.mcc, raid.mnc, raid.lac, raid.rac);
+ osmo_rai_name(&raid));
if (rc < 0)
return rc;
@@ -1657,8 +1656,7 @@
bssgp_nsi = nsi;
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
- gbcfg.core_mcc = 123;
- gbcfg.core_mnc = 456;
+ gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
gbcfg.core_apn = talloc_zero_size(NULL, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 0;
@@ -1998,8 +1996,7 @@
bssgp_nsi = nsi;
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
- gbcfg.core_mcc = 0;
- gbcfg.core_mnc = 0;
+ gbcfg.core_plmn = (struct osmo_plmn_id){};
gbcfg.core_apn = talloc_zero_size(NULL, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 0;
@@ -2232,8 +2229,7 @@
bssgp_nsi = nsi;
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
- gbcfg.core_mcc = 123;
- gbcfg.core_mnc = 456;
+ gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
gbcfg.core_apn = talloc_zero_size(NULL, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 1;
@@ -2551,8 +2547,7 @@
bssgp_nsi = nsi;
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
- gbcfg.core_mcc = 123;
- gbcfg.core_mnc = 456;
+ gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
gbcfg.core_apn = talloc_zero_size(NULL, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 1;
@@ -2735,8 +2730,7 @@
bssgp_nsi = nsi;
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
- gbcfg.core_mcc = 123;
- gbcfg.core_mnc = 456;
+ gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
gbcfg.core_apn = talloc_zero_size(NULL, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 1;
@@ -3061,8 +3055,7 @@
bssgp_nsi = nsi;
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
- gbcfg.core_mcc = 123;
- gbcfg.core_mnc = 456;
+ gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 };
gbcfg.core_apn = talloc_zero_size(NULL, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 1;
@@ -3540,8 +3533,7 @@
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
gbcfg.patch_ptmsi = 0;
gbcfg.acquire_imsi = 1;
- gbcfg.core_mcc = 0;
- gbcfg.core_mnc = 0;
+ gbcfg.core_plmn = (struct osmo_plmn_id){};
gbcfg.core_apn = NULL;
gbcfg.core_apn_size = 0;
gbcfg.route_to_sgsn2 = 0;
@@ -4841,8 +4833,7 @@
bssgp_nsi = nsi;
gbcfg.nsi = bssgp_nsi;
gbcfg.nsip_sgsn_nsei = SGSN_NSEI;
- gbcfg.core_mcc = 0;
- gbcfg.core_mnc = 0;
+ gbcfg.core_plmn = (struct osmo_plmn_id){};
gbcfg.core_apn = talloc_zero_size(NULL, 100);
gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
gbcfg.patch_ptmsi = 0;