Changes to compile with mnc_t.

Signed-off-by: Michael McTernan <mike.mcternan@wavemobile.com>
This commit is contained in:
Michael McTernan 2015-07-03 11:12:03 +01:00
parent f3405e5b03
commit 331dd01605
6 changed files with 19 additions and 11 deletions

View File

@ -27,7 +27,8 @@
static struct gprs_bssgp_pcu the_pcu = { 0, };
extern void *tall_pcu_ctx;
extern uint16_t spoof_mcc, spoof_mnc;
extern uint16_t spoof_mcc;
extern gsm_mnc_t spoof_mnc;
static void bvc_timeout(void *_priv);
@ -468,14 +469,13 @@ static void bvc_timeout(void *_priv)
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, gsm_mnc_t mnc, 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 */
@ -520,7 +520,11 @@ struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts
return NULL;
}
the_pcu.bctx->ra_id.mcc = spoof_mcc ? : mcc;
the_pcu.bctx->ra_id.mnc = spoof_mnc ? : mnc;
if (spoof_mnc.network_code)
the_pcu.bctx->ra_id.mnc = spoof_mnc;
else
the_pcu.bctx->ra_id.mnc = mnc;
the_pcu.bctx->ra_id.lac = lac;
the_pcu.bctx->ra_id.rac = rac;
the_pcu.bctx->cell_id = cell_id;

View File

@ -71,7 +71,7 @@ struct gprs_bssgp_pcu {
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 nsvci, uint16_t bvci, uint16_t mcc, gsm_mnc_t mnc,
uint16_t lac, uint16_t rac, uint16_t cell_id);
void gprs_bssgp_destroy(void);

View File

@ -329,7 +329,8 @@ bssgp_failed:
}
LOGP(DL1IF, LOGL_INFO, "BTS available\n");
LOGP(DL1IF, LOGL_DEBUG, " mcc=%x\n", info_ind->mcc);
LOGP(DL1IF, LOGL_DEBUG, " mnc=%x\n", info_ind->mnc);
LOGP(DL1IF, LOGL_DEBUG, " mnc=%0*u\n",
info_ind->mnc.two_digits ? 2 : 3, info_ind->mnc.network_code);
LOGP(DL1IF, LOGL_DEBUG, " lac=%d\n", info_ind->lac);
LOGP(DL1IF, LOGL_DEBUG, " rac=%d\n", info_ind->rac);
LOGP(DL1IF, LOGL_DEBUG, " cell_id=%d\n", ntohs(info_ind->cell_id));

View File

@ -35,7 +35,8 @@ extern "C" {
}
extern struct gprs_nsvc *nsvc;
uint16_t spoof_mcc = 0, spoof_mnc = 0;
uint16_t spoof_mcc = 0;
gsm_mnc_t spoof_mnc = { 0, false };
static int config_given = 0;
static char *config_file = strdup("osmo-pcu.cfg");
extern struct vty_app_info pcu_vty_info;
@ -94,7 +95,7 @@ static void handle_options(int argc, char **argv)
spoof_mcc = atoi(optarg);
break;
case 'n':
spoof_mnc = atoi(optarg);
spoof_mnc = gsm48_str_to_mnc(optarg);
break;
case 'V':
print_version(1);
@ -181,7 +182,7 @@ int main(int argc, char *argv[])
pcu_vty_init(&gprs_log_info);
handle_options(argc, argv);
if ((!!spoof_mcc) + (!!spoof_mnc) == 1) {
if ((!!spoof_mcc) + (!!spoof_mnc.network_code) == 1) {
fprintf(stderr, "--mcc and --mnc must be specified "
"together.\n");
exit(0);

View File

@ -84,7 +84,9 @@ struct gsm_pcu_if_info_ind {
struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */
uint8_t bsic;
/* RAI */
uint16_t mcc, mnc, lac, rac;
uint16_t mcc;
gsm_mnc_t mnc;
uint16_t lac, rac;
/* NSE */
uint16_t nsei;
uint8_t nse_timer[7];

View File

@ -99,7 +99,7 @@ void create_and_connect_bssgp(struct gprs_rlcmac_bts *bts,
struct gprs_bssgp_pcu *pcu;
pcu = gprs_bssgp_create_and_connect(bts, 0, sgsn_ip, sgsn_port,
20, 20, 20, 0x901, 0x99, 1, 0, 0);
20, 20, 20, 0x901, gsm48_str_to_mnc("99"), 1, 0, 0);
pcu->on_unblock_ack = bvci_unblocked;
pcu->on_dl_unit_data = bssgp_data;
}