From 2fad9ded017abdd84866915f687840d3dbbb201e Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 18 Nov 2021 17:40:00 +0000 Subject: [PATCH] Make sure that the pcap is started before NGAP init, so that the NGSetupRequest is caught --- lib/include/srsran/common/ngap_pcap.h | 3 ++- lib/src/common/pcap.c | 2 +- srsenb/src/main.cc | 8 -------- srsgnb/src/stack/gnb_stack_nr.cc | 10 +++++----- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/include/srsran/common/ngap_pcap.h b/lib/include/srsran/common/ngap_pcap.h index 434a0a271..e56c0ff6f 100644 --- a/lib/include/srsran/common/ngap_pcap.h +++ b/lib/include/srsran/common/ngap_pcap.h @@ -22,6 +22,7 @@ class ngap_pcap { public: ngap_pcap(); + ~ngap_pcap() = default; ngap_pcap(const ngap_pcap& other) = delete; ngap_pcap& operator=(const ngap_pcap& other) = delete; ngap_pcap(ngap_pcap&& other) = delete; @@ -40,4 +41,4 @@ private: } // namespace srsran -#endif // SRSRAN_NAS_PCAP_H +#endif // SRSRAN_NGAP_PCAP_H diff --git a/lib/src/common/pcap.c b/lib/src/common/pcap.c index ea454cd3b..596b3073d 100644 --- a/lib/src/common/pcap.c +++ b/lib/src/common/pcap.c @@ -336,7 +336,7 @@ int LTE_PCAP_S1AP_WritePDU(FILE* fd, S1AP_Context_Info_t* context, const unsigne return 1; } -/* Write an individual PDU (PCAP packet header + s1ap-context + s1ap-pdu) */ +/* Write an individual PDU (PCAP packet header + ngap-context + ngap-pdu) */ int LTE_PCAP_NGAP_WritePDU(FILE* fd, NGAP_Context_Info_t* context, const unsigned char* PDU, unsigned int length) { pcaprec_hdr_t packet_header; diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index dc9409539..b46713f98 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -262,14 +262,6 @@ void parse_args(all_args_t* args, int argc, char* argv[]) ("scheduler.nr_pusch_mcs", bpo::value(&args->nr_stack.mac.sched_cfg.fixed_ul_mcs)->default_value(28), "Fixed NR UL MCS (-1 for dynamic).") ("expert.nr_pusch_max_its", bpo::value(&args->phy.nr_pusch_max_its)->default_value(10), "Maximum number of LDPC iterations for NR.") - //NGAP section - ("gnb.enb_id", bpo::value(&args->nr_stack.ngap.gnb_id)->default_value(0), "gNodeB ID") - ("gnb.name", bpo::value(&args->nr_stack.ngap.gnb_name)->default_value("srsgnb01"), "gNodeB Name") - ("gnb.amf_addr", bpo::value(&args->nr_stack.ngap.amf_addr)->default_value("127.0.0.1"),"IP address of MME for S1 connection") - ("gnb.gtp_bind_addr", bpo::value(&args->nr_stack.ngap.gtp_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for GTP connection") - ("gnb.gtp_advertise_addr", bpo::value(&args->nr_stack.ngap.gtp_advertise_addr)->default_value(""), "IP address of eNB to advertise for DL GTP-U Traffic") - ("gnb.ngc_bind_addr", bpo::value(&args->nr_stack.ngap.ngc_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for S1AP connection") - // VNF params ("vnf.type", bpo::value(&args->phy.vnf_args.type)->default_value("gnb"), "VNF instance type [gnb,ue].") ("vnf.addr", bpo::value(&args->phy.vnf_args.bind_addr)->default_value("localhost"), "Address to bind VNF interface.") diff --git a/srsgnb/src/stack/gnb_stack_nr.cc b/srsgnb/src/stack/gnb_stack_nr.cc index 7524fc516..20c6586ff 100644 --- a/srsgnb/src/stack/gnb_stack_nr.cc +++ b/srsgnb/src/stack/gnb_stack_nr.cc @@ -98,17 +98,17 @@ int gnb_stack_nr::init(const gnb_stack_args_t& args_, } if (ngap != nullptr) { + if (args.ngap_pcap.enable) { + ngap_pcap.open(args.ngap_pcap.filename.c_str()); + ngap->start_pcap(&ngap_pcap); + } + ngap->init(args.ngap, &rrc, nullptr); gtpu_args_t gtpu_args; gtpu_args.embms_enable = false; gtpu_args.mme_addr = args.ngap.amf_addr; gtpu_args.gtp_bind_addr = args.ngap.gtp_bind_addr; gtpu->init(gtpu_args, &pdcp); - - if (args.ngap_pcap.enable) { - ngap_pcap.open(args.ngap_pcap.filename.c_str()); - ngap->start_pcap(&ngap_pcap); - } } // TODO: add SDAP