Skip to content

Commit 179d0f2

Browse files
robertfalkenbergcodebot
authored andcommitted
gnb,cu_up: add option to set external address of N3 interface
1 parent ae49fa7 commit 179d0f2

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

apps/gnb/gnb_appconfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ struct amf_appconfig {
649649
std::string n2_bind_interface = "auto";
650650
std::string n3_bind_addr = "auto";
651651
std::string n3_bind_interface = "auto";
652+
std::string n3_ext_addr = "auto";
652653
int sctp_rto_initial = 120;
653654
int sctp_rto_min = 120;
654655
int sctp_rto_max = 500;

apps/gnb/gnb_appconfig_translators.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ srs_cu_up::cu_up_configuration srsran::generate_cu_up_config(const gnb_appconfig
417417
} else {
418418
out_cfg.net_cfg.n3_bind_addr = config.amf_cfg.n3_bind_addr;
419419
}
420+
out_cfg.net_cfg.n3_ext_addr = config.amf_cfg.n3_ext_addr;
420421
out_cfg.net_cfg.n3_bind_interface = config.amf_cfg.n3_bind_interface;
421422
out_cfg.net_cfg.n3_rx_max_mmsg = config.amf_cfg.udp_rx_max_msgs;
422423
out_cfg.net_cfg.f1u_bind_addr = config.amf_cfg.bind_addr; // FIXME: check if this can be removed for co-located case

include/srsran/cu_up/cu_up_configuration.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ struct network_interface_config {
3535
/// Local IP address to bind for connection from UPF to receive downlink user-plane traffic (N3 interface).
3636
std::string n3_bind_addr = "127.0.1.1";
3737

38+
/// External IP address that is advertised to receive GTP-U packets from UPF via N3 interface.
39+
/// It defaults to \c n3_bind_addr but may differ in case the CU-UP is behind a NAT.
40+
std::string n3_ext_addr = "auto";
41+
3842
/// Interface name to bind the N3. `auto` does not force a specific interface and uses a normal `bind()`.
3943
std::string n3_bind_interface = "auto";
4044

lib/cu_up/pdu_session_manager_impl.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,12 @@ pdu_session_setup_result pdu_session_manager_impl::setup_pdu_session(const e1ap_
260260
// Allocate local TEID
261261
new_session->local_teid = allocate_local_teid(new_session->pdu_session_id);
262262

263-
pdu_session_result.gtp_tunnel = up_transport_layer_info(
264-
transport_layer_address::create_from_string(net_config.n3_bind_addr), new_session->local_teid);
263+
// Advertise either local or external IP address of N3 interface
264+
const std::string& n3_addr = net_config.n3_ext_addr.empty() || net_config.n3_ext_addr == "auto"
265+
? net_config.n3_bind_addr
266+
: net_config.n3_ext_addr;
267+
pdu_session_result.gtp_tunnel =
268+
up_transport_layer_info(transport_layer_address::create_from_string(n3_addr), new_session->local_teid);
265269

266270
// Create SDAP entity
267271
sdap_entity_creation_message sdap_msg = {ue_index, session.pdu_session_id, &new_session->sdap_to_gtpu_adapter};

0 commit comments

Comments
 (0)