Add an option to allow everyone to the network.
This should move out of gsm_04_08 and the accept, reject policy should be controllable by the higher levels.
This commit is contained in:
parent
a767794d96
commit
89824fc466
|
@ -375,6 +375,7 @@ enum gsm48_reject_value {
|
|||
struct msgb;
|
||||
struct gsm_bts;
|
||||
|
||||
void gsm0408_allow_everyone(int allow);
|
||||
int gsm0408_rcvmsg(struct msgb *msg);
|
||||
void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc,
|
||||
u_int16_t mnc, u_int16_t lac);
|
||||
|
|
|
@ -669,6 +669,7 @@ static void print_help()
|
|||
printf(" -n --network-code number(MNC) \n");
|
||||
printf(" -c --country-code number (MCC) \n");
|
||||
printf(" -l --database db-name The database to use\n");
|
||||
printf(" -a --authorize-everyone Allow everyone into the network.\n");
|
||||
printf(" -h --help this text\n");
|
||||
}
|
||||
|
||||
|
@ -683,10 +684,11 @@ static void handle_options(int argc, char** argv)
|
|||
{"network-code", 1, 0, 'n'},
|
||||
{"country-code", 1, 0, 'c'},
|
||||
{"database", 1, 0, 'l'},
|
||||
{"authorize-everyone", 0, 0, 'a'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long(argc, argv, "hc:n:d:s",
|
||||
c = getopt_long(argc, argv, "hc:n:d:sa",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
@ -711,6 +713,9 @@ static void handle_options(int argc, char** argv)
|
|||
case 'l':
|
||||
database_name = strdup(optarg);
|
||||
break;
|
||||
case 'a':
|
||||
gsm0408_allow_everyone(1);
|
||||
break;
|
||||
default:
|
||||
/* ignore */
|
||||
break;
|
||||
|
|
|
@ -51,6 +51,23 @@ struct gsm_lai {
|
|||
u_int16_t lac;
|
||||
};
|
||||
|
||||
static int authorize_everonye = 0;
|
||||
void gsm0408_allow_everyone(int everyone)
|
||||
{
|
||||
printf("Allowing everyone?\n");
|
||||
authorize_everonye = everyone;
|
||||
}
|
||||
|
||||
static int authorize_subscriber(struct gsm_subscriber *subscriber)
|
||||
{
|
||||
if (!subscriber)
|
||||
return 0;
|
||||
|
||||
if (authorize_everonye)
|
||||
return 1;
|
||||
|
||||
return subscriber->authorized;
|
||||
}
|
||||
|
||||
|
||||
static void parse_lai(struct gsm_lai *lai, const struct gsm48_loc_area_id *lai48)
|
||||
|
@ -293,7 +310,7 @@ static int mm_rx_id_resp(struct msgb *msg)
|
|||
|
||||
/* We have a pending UPDATING REQUEST handle it now */
|
||||
if (lchan->pending_update_request) {
|
||||
if (lchan->subscr->authorized) {
|
||||
if (authorize_subscriber(lchan->subscr)) {
|
||||
db_subscriber_alloc_tmsi(lchan->subscr);
|
||||
tmsi = strtoul(lchan->subscr->tmsi, NULL, 10);
|
||||
return gsm0408_loc_upd_acc(msg->lchan, tmsi);
|
||||
|
@ -380,7 +397,7 @@ static int mm_rx_loc_upd_req(struct msgb *msg)
|
|||
lchan->subscr = subscr;
|
||||
|
||||
/* we know who we deal with and don't want him */
|
||||
if (subscr && !subscr->authorized) {
|
||||
if (subscr && !authorize_subscriber(subscr)) {
|
||||
schedule_reject(lchan);
|
||||
return 0;
|
||||
} else if (!subscr) {
|
||||
|
|
Loading…
Reference in New Issue