enb: fix handling of GTPU and S1AP init return values

if the eNB stack startup fails, for example due to binding
the wrong GTPU socket or similar issues, the eNB should stop
and log a message. Previously the return values for
S1AP and GTPU init were not even evaluated.
master
Andre Puschmann 5 years ago
parent 47145c18b7
commit b994255b35

@ -39,7 +39,7 @@ class gtpu final : public gtpu_interface_rrc, public gtpu_interface_pdcp
public:
gtpu();
bool init(std::string gtp_bind_addr_,
int init(std::string gtp_bind_addr_,
std::string mme_addr_,
std::string m1u_multiaddr_,
std::string m1u_if_addr_,

@ -56,7 +56,7 @@ public:
static const uint32_t ts1_reloc_overall_timeout_ms = 10000;
s1ap();
bool init(s1ap_args_t args_,
int init(s1ap_args_t args_,
rrc_interface_s1ap* rrc_,
srslte::timer_handler* timers_,
srsenb::stack_interface_s1ap_lte* stack_);

@ -42,6 +42,7 @@ enb::~enb()
int enb::init(const all_args_t& args_, srslte::logger* logger_)
{
int ret = SRSLTE_SUCCESS;
logger = logger_;
// Init UE log
@ -81,17 +82,17 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
// Init layers
if (lte_radio->init(args.rf, lte_phy.get())) {
log.console("Error initializing radio.\n");
return SRSLTE_ERROR;
ret = SRSLTE_ERROR;
}
if (lte_phy->init(args.phy, phy_cfg, lte_radio.get(), lte_stack.get())) {
log.console("Error initializing PHY.\n");
return SRSLTE_ERROR;
ret = SRSLTE_ERROR;
}
if (lte_stack->init(args.stack, rrc_cfg, lte_phy.get())) {
log.console("Error initializing stack.\n");
return SRSLTE_ERROR;
ret = SRSLTE_ERROR;
}
stack = std::move(lte_stack);
@ -101,9 +102,9 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_)
log.console("\n==== eNodeB started ===\n");
log.console("Type <t> to view trace\n");
started = true;
started = (ret == SRSLTE_SUCCESS);
return SRSLTE_SUCCESS;
return ret;
}
void enb::stop()

@ -107,14 +107,20 @@ int enb_stack_lte::init(const stack_args_t& args_, const rrc_cfg_t& rrc_cfg_)
rlc.init(&pdcp, &rrc, &mac, &timers, rlc_log);
pdcp.init(&rlc, &rrc, &gtpu);
rrc.init(rrc_cfg, phy, &mac, &rlc, &pdcp, &s1ap, &gtpu, &timers);
s1ap.init(args.s1ap, &rrc, &timers, this);
gtpu.init(args.s1ap.gtp_bind_addr,
args.s1ap.mme_addr,
args.embms.m1u_multiaddr,
args.embms.m1u_if_addr,
&pdcp,
this,
args.embms.enable);
if (s1ap.init(args.s1ap, &rrc, &timers, this) != SRSLTE_SUCCESS) {
stack_log->error("Couldn't initialize S1AP\n");
return SRSLTE_ERROR;
}
if (gtpu.init(args.s1ap.gtp_bind_addr,
args.s1ap.mme_addr,
args.embms.m1u_multiaddr,
args.embms.m1u_if_addr,
&pdcp,
this,
args.embms.enable)) {
stack_log->error("Couldn't initialize GTPU\n");
return SRSLTE_ERROR;
}
started = true;
start(STACK_MAIN_THREAD_PRIO);

@ -33,13 +33,13 @@ namespace srsenb {
gtpu::gtpu() : m1u(this), gtpu_log("GTPU") {}
bool gtpu::init(std::string gtp_bind_addr_,
std::string mme_addr_,
std::string m1u_multiaddr_,
std::string m1u_if_addr_,
srsenb::pdcp_interface_gtpu* pdcp_,
stack_interface_gtpu_lte* stack_,
bool enable_mbsfn_)
int gtpu::init(std::string gtp_bind_addr_,
std::string mme_addr_,
std::string m1u_multiaddr_,
std::string m1u_if_addr_,
srsenb::pdcp_interface_gtpu* pdcp_,
stack_interface_gtpu_lte* stack_,
bool enable_mbsfn_)
{
pdcp = pdcp_;
gtp_bind_addr = gtp_bind_addr_;
@ -47,13 +47,13 @@ bool gtpu::init(std::string gtp_bind_addr_,
pool = byte_buffer_pool::get_instance();
stack = stack_;
char errbuf[128];
char errbuf[128] = {};
// Set up socket
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
gtpu_log->error("Failed to create socket\n");
return false;
return SRSLTE_ERROR;
}
int enable = 1;
#if defined(SO_REUSEADDR)
@ -75,7 +75,7 @@ bool gtpu::init(std::string gtp_bind_addr_,
snprintf(errbuf, sizeof(errbuf), "%s", strerror(errno));
gtpu_log->error("Failed to bind on address %s, port %d: %s\n", gtp_bind_addr.c_str(), GTPU_PORT, errbuf);
gtpu_log->console("Failed to bind on address %s, port %d: %s\n", gtp_bind_addr.c_str(), GTPU_PORT, errbuf);
return false;
return SRSLTE_ERROR;
}
stack->add_gtpu_s1u_socket_handler(fd);
@ -84,10 +84,10 @@ bool gtpu::init(std::string gtp_bind_addr_,
enable_mbsfn = enable_mbsfn_;
if (enable_mbsfn) {
if (not m1u.init(m1u_multiaddr_, m1u_if_addr_)) {
return false;
return SRSLTE_ERROR;
}
}
return true;
return SRSLTE_SUCCESS;
}
void gtpu::stop()

@ -221,10 +221,10 @@ void s1ap::s1_setup_proc_t::then(const srslte::proc_state_t& result) const
s1ap::s1ap() : s1setup_proc(this) {}
bool s1ap::init(s1ap_args_t args_,
rrc_interface_s1ap* rrc_,
srslte::timer_handler* timers_,
srsenb::stack_interface_s1ap_lte* stack_)
int s1ap::init(s1ap_args_t args_,
rrc_interface_s1ap* rrc_,
srslte::timer_handler* timers_,
srsenb::stack_interface_s1ap_lte* stack_)
{
rrc = rrc_;
args = args_;
@ -259,7 +259,7 @@ bool s1ap::init(s1ap_args_t args_,
s1ap_log->error("Failed to initiate S1Setup procedure.\n");
}
return true;
return SRSLTE_SUCCESS;
}
void s1ap::stop()

Loading…
Cancel
Save