mirror of https://github.com/PentHertz/srsLTE.git
Added config option to enable pcap.
This commit is contained in:
parent
ba5708dc60
commit
b89ad628e2
|
@ -45,8 +45,21 @@ db_file = user_db.csv
|
|||
#####################################################################
|
||||
|
||||
[spgw]
|
||||
gtpu_bind_addr=127.0.1.100
|
||||
sgi_if_addr=172.16.0.1
|
||||
gtpu_bind_addr = 127.0.1.100
|
||||
sgi_if_addr = 172.16.0.1
|
||||
|
||||
####################################################################
|
||||
# PCAP configuration
|
||||
#
|
||||
# Enable PCAP tracing of S1AP packets
|
||||
#
|
||||
# enable: Enable or disable the PCAP.
|
||||
# filename: File name where to save the PCAP.
|
||||
#
|
||||
####################################################################
|
||||
[pcap]
|
||||
enable = false
|
||||
filename = /tmp/epc.pcap
|
||||
|
||||
####################################################################
|
||||
# Log configuration
|
||||
|
|
|
@ -128,6 +128,7 @@ private:
|
|||
mme_gtpc *m_mme_gtpc;
|
||||
|
||||
//PCAP
|
||||
bool m_pcap_enable;
|
||||
srslte::s1ap_pcap m_pcap;
|
||||
};
|
||||
|
||||
|
|
|
@ -93,6 +93,8 @@ typedef struct{
|
|||
std::string mme_name;
|
||||
std::string dns_addr;
|
||||
std::string mme_apn;
|
||||
bool pcap_enable;
|
||||
std::string pcap_filename;
|
||||
} s1ap_args_t;
|
||||
|
||||
typedef struct{
|
||||
|
|
|
@ -100,35 +100,38 @@ parse_args(all_args_t *args, int argc, char* argv[]) {
|
|||
bpo::options_description common("Configuration options");
|
||||
common.add_options()
|
||||
|
||||
("mme.mme_code", bpo::value<string>(&mme_code)->default_value("0x01"), "MME Code")
|
||||
("mme.name", bpo::value<string>(&mme_name)->default_value("srsmme01"), "MME Name")
|
||||
("mme.mme_group", bpo::value<string>(&mme_group)->default_value("0x01"), "Cell ID")
|
||||
("mme.tac", bpo::value<string>(&tac)->default_value("0x0"), "Tracking Area Code")
|
||||
("mme.mcc", bpo::value<string>(&mcc)->default_value("001"), "Mobile Country Code")
|
||||
("mme.mnc", bpo::value<string>(&mnc)->default_value("01"), "Mobile Network Code")
|
||||
("mme.mme_bind_addr", bpo::value<string>(&mme_bind_addr)->default_value("127.0.0.1"),"IP address of MME for S1 connnection")
|
||||
("mme.dns_addr", bpo::value<string>(&dns_addr)->default_value("8.8.8.8"),"IP address of the DNS server for the UEs")
|
||||
("mme.apn", bpo::value<string>(&mme_apn)->default_value(""), "Set Access Point Name (APN) for data services")
|
||||
("hss.db_file", bpo::value<string>(&hss_db_file)->default_value("ue_db.csv"),".csv file that stores UE's keys")
|
||||
("hss.auth_algo", bpo::value<string>(&hss_auth_algo)->default_value("milenage"),"HSS uthentication algorithm.")
|
||||
("spgw.gtpu_bind_addr", bpo::value<string>(&spgw_bind_addr)->default_value("127.0.0.1"),"IP address of SP-GW for the S1-U connection")
|
||||
("spgw.sgi_if_addr", bpo::value<string>(&sgi_if_addr)->default_value("176.16.0.1"),"IP address of TUN interface for the SGi connection")
|
||||
("mme.mme_code", bpo::value<string>(&mme_code)->default_value("0x01"), "MME Code")
|
||||
("mme.name", bpo::value<string>(&mme_name)->default_value("srsmme01"), "MME Name")
|
||||
("mme.mme_group", bpo::value<string>(&mme_group)->default_value("0x01"), "Cell ID")
|
||||
("mme.tac", bpo::value<string>(&tac)->default_value("0x0"), "Tracking Area Code")
|
||||
("mme.mcc", bpo::value<string>(&mcc)->default_value("001"), "Mobile Country Code")
|
||||
("mme.mnc", bpo::value<string>(&mnc)->default_value("01"), "Mobile Network Code")
|
||||
("mme.mme_bind_addr", bpo::value<string>(&mme_bind_addr)->default_value("127.0.0.1"), "IP address of MME for S1 connnection")
|
||||
("mme.dns_addr", bpo::value<string>(&dns_addr)->default_value("8.8.8.8"), "IP address of the DNS server for the UEs")
|
||||
("mme.apn", bpo::value<string>(&mme_apn)->default_value(""), "Set Access Point Name (APN) for data services")
|
||||
("hss.db_file", bpo::value<string>(&hss_db_file)->default_value("ue_db.csv"), ".csv file that stores UE's keys")
|
||||
("hss.auth_algo", bpo::value<string>(&hss_auth_algo)->default_value("milenage"), "HSS uthentication algorithm.")
|
||||
("spgw.gtpu_bind_addr", bpo::value<string>(&spgw_bind_addr)->default_value("127.0.0.1"), "IP address of SP-GW for the S1-U connection")
|
||||
("spgw.sgi_if_addr", bpo::value<string>(&sgi_if_addr)->default_value("176.16.0.1"), "IP address of TUN interface for the SGi connection")
|
||||
|
||||
("log.s1ap_level", bpo::value<string>(&args->log_args.s1ap_level), "MME S1AP log level")
|
||||
("log.s1ap_hex_limit", bpo::value<int>(&args->log_args.s1ap_hex_limit), "MME S1AP log hex dump limit")
|
||||
("log.gtpc_level", bpo::value<string>(&args->log_args.gtpc_level), "MME GTPC log level")
|
||||
("log.gtpc_hex_limit", bpo::value<int>(&args->log_args.gtpc_hex_limit), "MME GTPC log hex dump limit")
|
||||
("log.spgw_level", bpo::value<string>(&args->log_args.spgw_level), "SPGW log level")
|
||||
("log.spgw_hex_limit", bpo::value<int>(&args->log_args.spgw_hex_limit), "SPGW log hex dump limit")
|
||||
("pcap.enable", bpo::value<bool>(&args->mme_args.s1ap_args.pcap_enable)->default_value(false), "Enable S1AP PCAP")
|
||||
("pcap.filename", bpo::value<string>(&args->mme_args.s1ap_args.pcap_filename)->default_value("/tmp/epc.pcap"), "PCAP filename")
|
||||
|
||||
("log.s1ap_level", bpo::value<string>(&args->log_args.s1ap_level), "MME S1AP log level")
|
||||
("log.s1ap_hex_limit", bpo::value<int>(&args->log_args.s1ap_hex_limit), "MME S1AP log hex dump limit")
|
||||
("log.gtpc_level", bpo::value<string>(&args->log_args.gtpc_level), "MME GTPC log level")
|
||||
("log.gtpc_hex_limit", bpo::value<int>(&args->log_args.gtpc_hex_limit), "MME GTPC log hex dump limit")
|
||||
("log.spgw_level", bpo::value<string>(&args->log_args.spgw_level), "SPGW log level")
|
||||
("log.spgw_hex_limit", bpo::value<int>(&args->log_args.spgw_hex_limit), "SPGW log hex dump limit")
|
||||
//("log.gtpu_level", bpo::value<string>(&args->log.gtpu_level), "GTPU log level")
|
||||
("log.hss_level", bpo::value<string>(&args->log_args.hss_level), "HSS log level")
|
||||
("log.hss_hex_limit", bpo::value<int>(&args->log_args.hss_hex_limit), "HSS log hex dump limit")
|
||||
("log.hss_level", bpo::value<string>(&args->log_args.hss_level), "HSS log level")
|
||||
("log.hss_hex_limit", bpo::value<int>(&args->log_args.hss_hex_limit), "HSS log hex dump limit")
|
||||
//("log.gtpu_hex_limit",bpo::value<int>(&args->log.gtpu_hex_limit), "GTPU log hex dump limit")
|
||||
|
||||
("log.all_level", bpo::value<string>(&args->log_args.all_level)->default_value("info"), "ALL log level")
|
||||
("log.all_hex_limit", bpo::value<int>(&args->log_args.all_hex_limit)->default_value(32), "ALL log hex dump limit")
|
||||
("log.all_level", bpo::value<string>(&args->log_args.all_level)->default_value("info"), "ALL log level")
|
||||
("log.all_hex_limit", bpo::value<int>(&args->log_args.all_hex_limit)->default_value(32), "ALL log hex dump limit")
|
||||
|
||||
("log.filename", bpo::value<string>(&args->log_args.filename)->default_value("/tmp/epc.log"),"Log filename")
|
||||
("log.filename", bpo::value<string>(&args->log_args.filename)->default_value("/tmp/epc.log"),"Log filename")
|
||||
;
|
||||
|
||||
// Positional options - config file location
|
||||
|
@ -141,7 +144,7 @@ parse_args(all_args_t *args, int argc, char* argv[]) {
|
|||
|
||||
// these options are allowed on the command line
|
||||
bpo::options_description cmdline_options;
|
||||
cmdline_options.add(common).add(position).add(general);
|
||||
cmdline_options.add(common).add(position).add(general);
|
||||
|
||||
// parse the command line and store result in vm
|
||||
bpo::variables_map vm;
|
||||
|
|
|
@ -100,8 +100,12 @@ s1ap::init(s1ap_args_t s1ap_args, srslte::log_filter *s1ap_log, hss_interface_s1
|
|||
m_s1mme = enb_listen();
|
||||
|
||||
//Init PCAP
|
||||
m_pcap.open("/tmp/epc.pcap");
|
||||
m_s1ap_log->info("S1AP Initialized\n");
|
||||
m_pcap_enable = s1ap_args.pcap_enable;
|
||||
if(m_pcap_enable)
|
||||
{
|
||||
m_pcap.open(s1ap_args.pcap_filename.c_str());
|
||||
m_s1ap_log->info("S1AP Initialized\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -134,7 +138,10 @@ s1ap::stop()
|
|||
s1ap_ctx_mngmt_proc::cleanup();
|
||||
|
||||
//PCAP
|
||||
m_pcap.close();
|
||||
if(m_pcap_enable)
|
||||
{
|
||||
m_pcap.close();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -213,7 +220,9 @@ s1ap::handle_s1ap_rx_pdu(srslte::byte_buffer_t *pdu, struct sctp_sndrcvinfo *enb
|
|||
return false;
|
||||
}
|
||||
|
||||
m_pcap.write_s1ap(pdu->msg,pdu->N_bytes);
|
||||
if(m_pcap_enable){
|
||||
m_pcap.write_s1ap(pdu->msg,pdu->N_bytes);
|
||||
}
|
||||
|
||||
switch(rx_pdu.choice_type) {
|
||||
case LIBLTE_S1AP_S1AP_PDU_CHOICE_INITIATINGMESSAGE:
|
||||
|
@ -503,7 +512,7 @@ s1ap::release_ue_ecm_ctx(uint32_t mme_ue_s1ap_id)
|
|||
m_s1ap_log->error("Could not find eNB for UE release request.\n");
|
||||
return false;
|
||||
}
|
||||
uint16_t enb_id = it->second;
|
||||
uint16_t enb_id = it->second;
|
||||
std::map<int32_t,std::set<uint32_t> >::iterator ue_set = m_enb_assoc_to_ue_ids.find(ecm_ctx->enb_sri.sinfo_assoc_id);
|
||||
if(ue_set == m_enb_assoc_to_ue_ids.end())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue