Add feature to provide custom GTP-U (S1) address to be advertised inside S1AP messages

This feature is useful in scenarios where eNB is behind a NAT and EPC on public cloud
Since eNB's GTP-U can only bind to IP address visible in it's host (usually a private IP beind a NAT), it advertises the same to UE in S1AP message
resulting in traffic from EPC to eNB (DL traffic) not able to reach eNB. This commit solves this issue by providing a means to advertise a different IP address than the one GTP-U UDP socket is bound to.
This IP is usually advertised in InitialContextSetupResponse and E-RABSetupResponse.

In order to make use of this feature, use the following parameter in enb.conf

Example:

gtp_advertise_addr = 213.61.141.82
master
herlesupreeth 4 years ago committed by Andre Puschmann
parent aff9091ad3
commit 0f06ec0d9c

@ -26,6 +26,7 @@ struct s1ap_args_t {
uint16_t mnc; // BCD-coded with 0xF filler uint16_t mnc; // BCD-coded with 0xF filler
std::string mme_addr; std::string mme_addr;
std::string gtp_bind_addr; std::string gtp_bind_addr;
std::string gtp_advertise_addr;
std::string s1c_bind_addr; std::string s1c_bind_addr;
std::string enb_name; std::string enb_name;
}; };

@ -10,6 +10,7 @@
# mnc: Mobile Network Code # mnc: Mobile Network Code
# mme_addr: IP address of MME for S1 connnection # mme_addr: IP address of MME for S1 connnection
# gtp_bind_addr: Local IP address to bind for GTP connection # 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 # s1c_bind_addr: Local IP address to bind for S1AP connection
# n_prb: Number of Physical Resource Blocks (6,15,25,50,75,100) # n_prb: Number of Physical Resource Blocks (6,15,25,50,75,100)
# tm: Transmission mode 1-4 (TM1 default) # tm: Transmission mode 1-4 (TM1 default)

@ -71,6 +71,7 @@ void parse_args(all_args_t* args, int argc, char* argv[])
("enb.mnc", bpo::value<string>(&mnc)->default_value("01"), "Mobile Network Code") ("enb.mnc", bpo::value<string>(&mnc)->default_value("01"), "Mobile Network Code")
("enb.mme_addr", bpo::value<string>(&args->stack.s1ap.mme_addr)->default_value("127.0.0.1"),"IP address of MME for S1 connection") ("enb.mme_addr", bpo::value<string>(&args->stack.s1ap.mme_addr)->default_value("127.0.0.1"),"IP address of MME for S1 connection")
("enb.gtp_bind_addr", bpo::value<string>(&args->stack.s1ap.gtp_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for GTP connection") ("enb.gtp_bind_addr", bpo::value<string>(&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<string>(&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<string>(&args->stack.s1ap.s1c_bind_addr)->default_value("192.168.3.1"), "Local IP address to bind for S1AP connection") ("enb.s1c_bind_addr", bpo::value<string>(&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<uint32_t>(&args->enb.n_prb)->default_value(25), "Number of PRB") ("enb.n_prb", bpo::value<uint32_t>(&args->enb.n_prb)->default_value(25), "Number of PRB")
("enb.nof_ports", bpo::value<uint32_t>(&args->enb.nof_ports)->default_value(1), "Number of ports") ("enb.nof_ports", bpo::value<uint32_t>(&args->enb.nof_ports)->default_value(1), "Number of ports")

@ -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); 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(); auto& c = container.erab_admitted_list.value[i].value.erab_admitted_item();
c = admitted_bearers[i]; c = admitted_bearers[i];
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()); c.transport_layer_address = addr_to_asn1(args.gtp_bind_addr.c_str());
}
// If E-RAB is proposed for forward tunneling // If E-RAB is proposed for forward tunneling
if (c.dl_g_tp_teid_present) { 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 // Note: RRC does not yet update correctly gtpu transp_addr
transp_addr.resize(32); transp_addr.resize(32);
uint8_t addr[4]; uint8_t addr[4];
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); inet_pton(AF_INET, s1ap_ptr->args.gtp_bind_addr.c_str(), addr);
}
for (uint32_t j = 0; j < 4; ++j) { for (uint32_t j = 0; j < 4; ++j) {
transp_addr.data()[j] = addr[3 - j]; transp_addr.data()[j] = addr[3 - j];
} }

Loading…
Cancel
Save