From 23cc0ab011eae9acaf645a19d8c36cd46b629870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Mon, 9 Jul 2018 11:52:17 +0200 Subject: [PATCH 1/5] enb: add bind address for s1ap connection (#128) add s1c_bind_addr config option to specify the local bind address used for S1AP connections instead of using the GTP address. This allows operation on setups with split S1U and S1C networks. --- srsenb/enb.conf.example | 4 ++-- srsenb/hdr/upper/s1ap.h | 1 + srsenb/src/main.cc | 1 + srsenb/src/upper/s1ap.cc | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/srsenb/enb.conf.example b/srsenb/enb.conf.example index 4fa2a5731..1c7c93214 100644 --- a/srsenb/enb.conf.example +++ b/srsenb/enb.conf.example @@ -25,12 +25,12 @@ tac = 0x0007 mcc = 001 mnc = 01 mme_addr = 127.0.1.100 -gtp_bind_addr = 127.0.0.1 +gtp_bind_addr = 127.0.1.1 +s1c_bind_addr = 127.0.1.1 n_prb = 50 #tm = 4 #nof_ports = 2 - ##################################################################### # eNB configuration files # diff --git a/srsenb/hdr/upper/s1ap.h b/srsenb/hdr/upper/s1ap.h index 284b67d03..b686b6583 100644 --- a/srsenb/hdr/upper/s1ap.h +++ b/srsenb/hdr/upper/s1ap.h @@ -49,6 +49,7 @@ typedef struct { uint16_t mnc; // BCD-coded with 0xF filler std::string mme_addr; std::string gtp_bind_addr; + std::string s1c_bind_addr; std::string enb_name; }s1ap_args_t; diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index eab5d4bcf..3622f8d05 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -77,6 +77,7 @@ void parse_args(all_args_t *args, int argc, char* argv[]) { ("enb.mnc", bpo::value(&mnc)->default_value("01"), "Mobile Network Code") ("enb.mme_addr", bpo::value(&args->enb.s1ap.mme_addr)->default_value("127.0.0.1"),"IP address of MME for S1 connnection") ("enb.gtp_bind_addr", bpo::value(&args->enb.s1ap.gtp_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for GTP connection") + ("enb.s1c_bind_addr", bpo::value(&args->enb.s1ap.s1c_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for S1AP connection") ("enb.phy_cell_id", bpo::value(&args->enb.pci)->default_value(0), "Physical Cell Identity (PCI)") ("enb.n_prb", bpo::value(&args->enb.n_prb)->default_value(25), "Number of PRB") ("enb.nof_ports", bpo::value(&args->enb.nof_ports)->default_value(1), "Number of ports") diff --git a/srsenb/src/upper/s1ap.cc b/srsenb/src/upper/s1ap.cc index 8cc4bebda..1e2b25987 100644 --- a/srsenb/src/upper/s1ap.cc +++ b/srsenb/src/upper/s1ap.cc @@ -274,8 +274,8 @@ bool s1ap::connect_mme() memset(&local_addr, 0, sizeof(struct sockaddr_in)); local_addr.sin_family = ADDR_FAMILY; local_addr.sin_port = 0; // Any local port will do - if(inet_pton(AF_INET, args.gtp_bind_addr.c_str(), &(local_addr.sin_addr)) != 1) { - s1ap_log->error("Error converting IP address (%s) to sockaddr_in structure\n", args.gtp_bind_addr.c_str()); + if(inet_pton(AF_INET, args.s1c_bind_addr.c_str(), &(local_addr.sin_addr)) != 1) { + s1ap_log->error("Error converting IP address (%s) to sockaddr_in structure\n", args.s1c_bind_addr.c_str()); return false; } bind(socket_fd, (struct sockaddr *)&local_addr, sizeof(local_addr)); From 2098aa073993aabe04dcfa6d7d2793c98746d4dc Mon Sep 17 00:00:00 2001 From: Merlin Chlosta Date: Mon, 9 Jul 2018 11:53:24 +0200 Subject: [PATCH 2/5] add keys to loglevel info to simplify PCAP analysis (#194) --- srsue/src/upper/nas.cc | 6 +++--- srsue/src/upper/pcsc_usim.cc | 2 +- srsue/src/upper/rrc.cc | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index 2e491b733..569ef7529 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -757,7 +757,7 @@ void nas::parse_authentication_request(uint32_t lcid, byte_buffer_t *pdu) { if (auth_result == AUTH_OK) { nas_log->info("Network authentication successful\n"); send_authentication_response(res, res_len); - nas_log->info("Generated k_asme=%s\n", hex_to_string(ctxt.k_asme, 32).c_str()); + nas_log->info_hex(ctxt.k_asme, 32, "Generated k_asme:\n"); } else if (auth_result == AUTH_SYNCH_FAILURE) { nas_log->error("Network authentication synchronization failure.\n"); send_authentication_failure(LIBLTE_MME_EMM_CAUSE_SYNCH_FAILURE, res); @@ -878,8 +878,8 @@ void nas::parse_security_mode_command(uint32_t lcid, byte_buffer_t *pdu) // Generate NAS keys usim->generate_nas_keys(ctxt.k_asme, k_nas_enc, k_nas_int, ctxt.cipher_algo, ctxt.integ_algo); - nas_log->debug_hex(k_nas_enc, 32, "NAS encryption key - k_nas_enc"); - nas_log->debug_hex(k_nas_int, 32, "NAS integrity key - k_nas_int"); + nas_log->info_hex(k_nas_enc, 32, "NAS encryption key - k_nas_enc"); + nas_log->info_hex(k_nas_int, 32, "NAS integrity key - k_nas_int"); nas_log->debug("Generating integrity check. integ_algo:%d, count_dl:%d, lcid:%d\n", ctxt.integ_algo, ctxt.rx_count, lcid); diff --git a/srsue/src/upper/pcsc_usim.cc b/srsue/src/upper/pcsc_usim.cc index d94bebe1a..0d423c73c 100644 --- a/srsue/src/upper/pcsc_usim.cc +++ b/srsue/src/upper/pcsc_usim.cc @@ -250,7 +250,7 @@ auth_result_t pcsc_usim::generate_authentication_response(uint8_t *rand, mcc, mnc, k_asme); - log->debug_hex(k_asme, KEY_LEN, "K_ASME:\n"); + log->info_hex(k_asme, KEY_LEN, "K_ASME:\n"); ret = AUTH_OK; diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 66a7de33e..21d0b7833 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -2036,9 +2036,9 @@ void rrc::parse_dl_dcch(uint32_t lcid, byte_buffer_t *pdu) { uint8_t k_asme[32]; nas->get_k_asme(k_asme, 32); usim->generate_as_keys(k_asme, nas->get_ul_count(), k_rrc_enc, k_rrc_int, k_up_enc, k_up_int, cipher_algo, integ_algo); - rrc_log->debug_hex(k_rrc_enc, 32, "RRC encryption key - k_rrc_enc"); - rrc_log->debug_hex(k_rrc_int, 32, "RRC integrity key - k_rrc_int"); - rrc_log->debug_hex(k_up_enc, 32, "UP encryption key - k_up_enc"); + rrc_log->info_hex(k_rrc_enc, 32, "RRC encryption key - k_rrc_enc"); + rrc_log->info_hex(k_rrc_int, 32, "RRC integrity key - k_rrc_int"); + rrc_log->info_hex(k_up_enc, 32, "UP encryption key - k_up_enc"); security_is_activated = true; From bd5c1fd83a8e77e3c04fc3dc00a2cab544c312e4 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Tue, 10 Jul 2018 19:52:46 +0200 Subject: [PATCH 3/5] deallocate dedicatedInfoNAS in rrc --- lib/include/srslte/common/buffer_pool.h | 2 +- srsue/src/upper/nas.cc | 1 - srsue/src/upper/rrc.cc | 6 ++++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/include/srslte/common/buffer_pool.h b/lib/include/srslte/common/buffer_pool.h index 75c56fc0e..0a87c0df1 100644 --- a/lib/include/srslte/common/buffer_pool.h +++ b/lib/include/srslte/common/buffer_pool.h @@ -183,7 +183,7 @@ public: } b->reset(); if (!pool->deallocate(b)) { - fprintf(stderr, "Error deallocating PDU: Addr=0x%lx not found in pool\n", (uint64_t) b); + printf("Error deallocating PDU: Addr=0x%lx not found in pool\n", (uint64_t) b); } b = NULL; } diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index 569ef7529..8672eb062 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -250,7 +250,6 @@ bool nas::rrc_connect() { } } else { nas_log->error("Could not establish RRC connection\n"); - pool->deallocate(dedicatedInfoNAS); } return false; } diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 21d0b7833..440b4a318 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -526,6 +526,12 @@ bool rrc::connection_request(LIBLTE_RRC_CON_REQ_EST_CAUSE_ENUM cause, } } + if (!ret) { + rrc_log->warning("Could not estblish connection. Deallocating dedicatedInfoNAS PDU\n"); + pool->deallocate(this->dedicatedInfoNAS); + this->dedicatedInfoNAS = NULL; + } + pthread_mutex_unlock(&mutex); return ret; } From 7d324306b3652456649c5a279239e13959447193 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Sat, 7 Jul 2018 11:43:40 +0200 Subject: [PATCH 4/5] Default RLC to UM --- srsepc/user_db.csv.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srsepc/user_db.csv.example b/srsepc/user_db.csv.example index 77ab1e7a8..54d61eb30 100644 --- a/srsepc/user_db.csv.example +++ b/srsepc/user_db.csv.example @@ -12,5 +12,5 @@ # QCI: QoS Class Identifier for the UE's default bearer. # # Note: Lines starting by '#' are ignored and will be overwritten -ue1,001010123456789,00112233445566778899aabbccddeeff,opc,63bfa50ee6523365ff14c1f45f88737d,9001,000000001234,9 +ue1,001010123456789,00112233445566778899aabbccddeeff,opc,63bfa50ee6523365ff14c1f45f88737d,9001,000000001234,7 ue2,001010123456780,00112233445566778899aabbccddeeff,opc,63bfa50ee6523365ff14c1f45f88737d,8000,000000001234,7 From 9c5b9cef94c6720e44edff4cc96e97ec6fe126b8 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Sat, 7 Jul 2018 12:43:50 +0200 Subject: [PATCH 5/5] Set initial AGC gain correctly --- lib/src/phy/rf/rf_uhd_imp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/phy/rf/rf_uhd_imp.c b/lib/src/phy/rf/rf_uhd_imp.c index dc1bf6415..7fe291497 100644 --- a/lib/src/phy/rf/rf_uhd_imp.c +++ b/lib/src/phy/rf/rf_uhd_imp.c @@ -583,7 +583,7 @@ int rf_uhd_open_multi(char *args, void **h, uint32_t nof_channels) uhd_tx_metadata_make(&handler->tx_md, false, 0, 0, false, false); // Set starting gain to half maximum in case of using AGC - rf_uhd_set_rx_gain(handler, handler->info.max_tx_gain*0.7); + rf_uhd_set_rx_gain(handler, handler->info.max_rx_gain*0.7); #if HAVE_ASYNC_THREAD if (start_async_thread) {