diff --git a/lib/include/srsran/interfaces/enb_s1ap_interfaces.h b/lib/include/srsran/interfaces/enb_s1ap_interfaces.h index 38fdf98f0..299f1fe4f 100644 --- a/lib/include/srsran/interfaces/enb_s1ap_interfaces.h +++ b/lib/include/srsran/interfaces/enb_s1ap_interfaces.h @@ -26,6 +26,7 @@ struct s1ap_args_t { uint16_t mnc; // BCD-coded with 0xF filler std::string mme_addr; std::string gtp_bind_addr; + std::string gtp_advertise_addr; std::string s1c_bind_addr; std::string enb_name; }; diff --git a/srsenb/enb.conf.example b/srsenb/enb.conf.example index f89735a87..d902f6767 100644 --- a/srsenb/enb.conf.example +++ b/srsenb/enb.conf.example @@ -5,15 +5,16 @@ ##################################################################### # eNB configuration # -# enb_id: 20-bit eNB identifier. -# mcc: Mobile Country Code -# mnc: Mobile Network Code -# mme_addr: IP address of MME for S1 connnection -# gtp_bind_addr: Local IP address to bind for GTP connection -# s1c_bind_addr: Local IP address to bind for S1AP connection -# n_prb: Number of Physical Resource Blocks (6,15,25,50,75,100) -# tm: Transmission mode 1-4 (TM1 default) -# nof_ports: Number of Tx ports (1 port default, set to 2 for TM2/3/4) +# enb_id: 20-bit eNB identifier. +# mcc: Mobile Country Code +# mnc: Mobile Network Code +# mme_addr: IP address of MME for S1 connnection +# gtp_bind_addr: Local IP address to bind for GTP connection +# gtp_advertise_addr: IP address of eNB to advertise for DL GTP-U Traffic +# s1c_bind_addr: Local IP address to bind for S1AP connection +# n_prb: Number of Physical Resource Blocks (6,15,25,50,75,100) +# tm: Transmission mode 1-4 (TM1 default) +# nof_ports: Number of Tx ports (1 port default, set to 2 for TM2/3/4) # ##################################################################### [enb] diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 123a3c4eb..66b9c0aa5 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -64,18 +64,19 @@ void parse_args(all_args_t* args, int argc, char* argv[]) bpo::options_description common("Configuration options"); common.add_options() - ("enb.stack", bpo::value(&args->stack.type)->default_value("lte"), "Type of the upper stack [lte, nr]") - ("enb.enb_id", bpo::value(&enb_id)->default_value("0x0"), "eNodeB ID") - ("enb.name", bpo::value(&args->stack.s1ap.enb_name)->default_value("srsenb01"), "eNodeB Name") - ("enb.mcc", bpo::value(&mcc)->default_value("001"), "Mobile Country Code") - ("enb.mnc", bpo::value(&mnc)->default_value("01"), "Mobile Network Code") - ("enb.mme_addr", bpo::value(&args->stack.s1ap.mme_addr)->default_value("127.0.0.1"),"IP address of MME for S1 connection") - ("enb.gtp_bind_addr", bpo::value(&args->stack.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->stack.s1ap.s1c_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for S1AP connection") - ("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") - ("enb.tm", bpo::value(&args->enb.transmission_mode)->default_value(1), "Transmission mode (1-8)") - ("enb.p_a", bpo::value(&args->enb.p_a)->default_value(0.0f), "Power allocation rho_a (-6, -4.77, -3, -1.77, 0, 1, 2, 3)") + ("enb.stack", bpo::value(&args->stack.type)->default_value("lte"), "Type of the upper stack [lte, nr]") + ("enb.enb_id", bpo::value(&enb_id)->default_value("0x0"), "eNodeB ID") + ("enb.name", bpo::value(&args->stack.s1ap.enb_name)->default_value("srsenb01"), "eNodeB Name") + ("enb.mcc", bpo::value(&mcc)->default_value("001"), "Mobile Country Code") + ("enb.mnc", bpo::value(&mnc)->default_value("01"), "Mobile Network Code") + ("enb.mme_addr", bpo::value(&args->stack.s1ap.mme_addr)->default_value("127.0.0.1"),"IP address of MME for S1 connection") + ("enb.gtp_bind_addr", bpo::value(&args->stack.s1ap.gtp_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for GTP connection") + ("enb.gtp_advertise_addr", bpo::value(&args->stack.s1ap.gtp_advertise_addr)->default_value(""), "IP address of eNB to advertise for DL GTP-U Traffic") + ("enb.s1c_bind_addr", bpo::value(&args->stack.s1ap.s1c_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for S1AP connection") + ("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") + ("enb.tm", bpo::value(&args->enb.transmission_mode)->default_value(1), "Transmission mode (1-8)") + ("enb.p_a", bpo::value(&args->enb.p_a)->default_value(0.0f), "Power allocation rho_a (-6, -4.77, -3, -1.77, 0, 1, 2, 3)") ("enb_files.sib_config", bpo::value(&args->enb_files.sib_config)->default_value("sib.conf"), "SIB configuration files") ("enb_files.rr_config", bpo::value(&args->enb_files.rr_config)->default_value("rr.conf"), "RR configuration files") diff --git a/srsenb/src/stack/upper/s1ap.cc b/srsenb/src/stack/upper/s1ap.cc index fc729e137..8e2eeee21 100644 --- a/srsenb/src/stack/upper/s1ap.cc +++ b/srsenb/src/stack/upper/s1ap.cc @@ -1176,7 +1176,11 @@ bool s1ap::send_ho_req_ack(const asn1::s1ap::ho_request_s& msg, container.erab_admitted_list.value[i].load_info_obj(ASN1_S1AP_ID_ERAB_ADMITTED_ITEM); auto& c = container.erab_admitted_list.value[i].value.erab_admitted_item(); c = admitted_bearers[i]; - c.transport_layer_address = addr_to_asn1(args.gtp_bind_addr.c_str()); + if (!args.gtp_advertise_addr.empty()) { + c.transport_layer_address = addr_to_asn1(args.gtp_advertise_addr.c_str()); + } else { + c.transport_layer_address = addr_to_asn1(args.gtp_bind_addr.c_str()); + } // If E-RAB is proposed for forward tunneling if (c.dl_g_tp_teid_present) { @@ -1669,7 +1673,11 @@ void s1ap::ue::get_erab_addr(uint16_t erab_id, transp_addr_t& transp_addr, asn1: // Note: RRC does not yet update correctly gtpu transp_addr transp_addr.resize(32); uint8_t addr[4]; - inet_pton(AF_INET, s1ap_ptr->args.gtp_bind_addr.c_str(), addr); + if (!s1ap_ptr->args.gtp_advertise_addr.empty()) { + inet_pton(AF_INET, s1ap_ptr->args.gtp_advertise_addr.c_str(), addr); + } else { + inet_pton(AF_INET, s1ap_ptr->args.gtp_bind_addr.c_str(), addr); + } for (uint32_t j = 0; j < 4; ++j) { transp_addr.data()[j] = addr[3 - j]; }