add option to force IMSI attach by not loading NAS ctxt from file
This commit is contained in:
parent
fb82e00289
commit
01f6395d70
|
@ -38,17 +38,19 @@ namespace srslte {
|
||||||
class srslte_nas_config_t
|
class srslte_nas_config_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
srslte_nas_config_t(uint32_t lcid_ = 0, std::string apn_ = "", std::string user_ = "", std::string pass_ = "")
|
srslte_nas_config_t(uint32_t lcid_ = 0, std::string apn_ = "", std::string user_ = "", std::string pass_ = "", bool force_imsi_attach_ = false)
|
||||||
:lcid(lcid_),
|
:lcid(lcid_),
|
||||||
apn(apn_),
|
apn(apn_),
|
||||||
user(user_),
|
user(user_),
|
||||||
pass(pass_)
|
pass(pass_),
|
||||||
|
force_imsi_attach(force_imsi_attach_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
uint32_t lcid;
|
uint32_t lcid;
|
||||||
std::string apn;
|
std::string apn;
|
||||||
std::string user;
|
std::string user;
|
||||||
std::string pass;
|
std::string pass;
|
||||||
|
bool force_imsi_attach;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "phy/phy.h"
|
#include "phy/phy.h"
|
||||||
#include "upper/usim.h"
|
#include "upper/usim.h"
|
||||||
#include "upper/rrc.h"
|
#include "upper/rrc.h"
|
||||||
|
#include "upper/nas.h"
|
||||||
#include "srslte/interfaces/ue_interfaces.h"
|
#include "srslte/interfaces/ue_interfaces.h"
|
||||||
|
|
||||||
#include "srslte/common/logger.h"
|
#include "srslte/common/logger.h"
|
||||||
|
@ -129,9 +130,7 @@ typedef struct {
|
||||||
usim_args_t usim;
|
usim_args_t usim;
|
||||||
rrc_args_t rrc;
|
rrc_args_t rrc;
|
||||||
std::string ue_category_str;
|
std::string ue_category_str;
|
||||||
std::string apn_name;
|
nas_args_t nas;
|
||||||
std::string apn_user;
|
|
||||||
std::string apn_pass;
|
|
||||||
expert_args_t expert;
|
expert_args_t expert;
|
||||||
}all_args_t;
|
}all_args_t;
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,13 @@ using srslte::byte_buffer_t;
|
||||||
|
|
||||||
namespace srsue {
|
namespace srsue {
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
std::string apn_name;
|
||||||
|
std::string apn_user;
|
||||||
|
std::string apn_pass;
|
||||||
|
bool force_imsi_attach;
|
||||||
|
} nas_args_t;
|
||||||
|
|
||||||
// EMM states (3GPP 24.302 v10.0.0)
|
// EMM states (3GPP 24.302 v10.0.0)
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EMM_STATE_NULL = 0,
|
EMM_STATE_NULL = 0,
|
||||||
|
|
|
@ -84,9 +84,11 @@ void parse_args(all_args_t *args, int argc, char *argv[]) {
|
||||||
"UECapabilityInformation message. Default 0xe6041000")
|
"UECapabilityInformation message. Default 0xe6041000")
|
||||||
("rrc.ue_category", bpo::value<string>(&args->ue_category_str)->default_value("4"), "UE Category (1 to 5)")
|
("rrc.ue_category", bpo::value<string>(&args->ue_category_str)->default_value("4"), "UE Category (1 to 5)")
|
||||||
|
|
||||||
("nas.apn", bpo::value<string>(&args->apn_name)->default_value(""), "Set Access Point Name (APN) for data services")
|
("nas.apn", bpo::value<string>(&args->nas.apn_name)->default_value(""), "Set Access Point Name (APN) for data services")
|
||||||
("nas.user", bpo::value<string>(&args->apn_user)->default_value(""), "Username for CHAP authentication")
|
("nas.user", bpo::value<string>(&args->nas.apn_user)->default_value(""), "Username for CHAP authentication")
|
||||||
("nas.pass", bpo::value<string>(&args->apn_pass)->default_value(""), "Password for CHAP authentication")
|
("nas.pass", bpo::value<string>(&args->nas.apn_pass)->default_value(""), "Password for CHAP authentication")
|
||||||
|
("nas.force_imsi_attach", bpo::value<bool>(&args->nas.force_imsi_attach)->default_value(false), "Whether to always perform an IMSI attach")
|
||||||
|
|
||||||
|
|
||||||
("pcap.enable", bpo::value<bool>(&args->pcap.enable)->default_value(false), "Enable MAC packet captures for wireshark")
|
("pcap.enable", bpo::value<bool>(&args->pcap.enable)->default_value(false), "Enable MAC packet captures for wireshark")
|
||||||
("pcap.filename", bpo::value<string>(&args->pcap.filename)->default_value("ue.pcap"), "MAC layer capture filename")
|
("pcap.filename", bpo::value<string>(&args->pcap.filename)->default_value("ue.pcap"), "MAC layer capture filename")
|
||||||
|
|
|
@ -210,7 +210,7 @@ bool ue::init(all_args_t *args_) {
|
||||||
rlc.init(&pdcp, &rrc, this, &rlc_log, &mac, 0 /* RB_ID_SRB0 */);
|
rlc.init(&pdcp, &rrc, this, &rlc_log, &mac, 0 /* RB_ID_SRB0 */);
|
||||||
pdcp.init(&rlc, &rrc, &gw, &pdcp_log, 0 /* RB_ID_SRB0 */, SECURITY_DIRECTION_UPLINK);
|
pdcp.init(&rlc, &rrc, &gw, &pdcp_log, 0 /* RB_ID_SRB0 */, SECURITY_DIRECTION_UPLINK);
|
||||||
|
|
||||||
srslte_nas_config_t nas_cfg(1, args->apn_name, args->apn_user, args->apn_pass); /* RB_ID_SRB1 */
|
srslte_nas_config_t nas_cfg(1, args->nas.apn_name, args->nas.apn_user, args->nas.apn_pass, args->nas.force_imsi_attach); /* RB_ID_SRB1 */
|
||||||
nas.init(usim, &rrc, &gw, &nas_log, nas_cfg);
|
nas.init(usim, &rrc, &gw, &nas_log, nas_cfg);
|
||||||
gw.init(&pdcp, &nas, &gw_log, 3 /* RB_ID_DRB1 */);
|
gw.init(&pdcp, &nas, &gw_log, 3 /* RB_ID_DRB1 */);
|
||||||
gw.set_netmask(args->expert.ip_netmask);
|
gw.set_netmask(args->expert.ip_netmask);
|
||||||
|
|
|
@ -1364,6 +1364,11 @@ bool nas::read_ctxt_file(nas_sec_ctxt *ctxt)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cfg.force_imsi_attach) {
|
||||||
|
nas_log->info("Skip reading context from file.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
file.open(".ctxt", std::ios::in);
|
file.open(".ctxt", std::ios::in);
|
||||||
if(file.is_open()) {
|
if(file.is_open()) {
|
||||||
if(!readvar(file, "m_tmsi=", &ctxt->guti.m_tmsi)) {return false;}
|
if(!readvar(file, "m_tmsi=", &ctxt->guti.m_tmsi)) {return false;}
|
||||||
|
|
|
@ -119,11 +119,16 @@ imei = 353490069873319
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# NAS configuration
|
# NAS configuration
|
||||||
#
|
#
|
||||||
# apn: Set Access Point Name (APN)
|
# apn: Set Access Point Name (APN)
|
||||||
|
# user: Username for CHAP authentication
|
||||||
|
# pass: Password for CHAP authentication
|
||||||
|
# force_imsi_attach: Whether to always perform an IMSI
|
||||||
#####################################################################
|
#####################################################################
|
||||||
[nas]
|
[nas]
|
||||||
# apn = internetinternet
|
#apn = internetinternet
|
||||||
|
#user = srsuser
|
||||||
|
#pass = srspass
|
||||||
|
#force_imsi_attach = false
|
||||||
|
|
||||||
[gui]
|
[gui]
|
||||||
enable = false
|
enable = false
|
||||||
|
|
Loading…
Reference in New Issue