Proper exit if bsc_nat_fsm fails to start
Instead of segfaulting later on, properly exit if the bsc_nat_fsm does not start. One reason for having it fail could be a missing mgw pool config block. Related: SYS#5560 Change-Id: Ia8bbe6ae908d5c3ce49f71b43c950497aeebb6d6
This commit is contained in:
parent
e04bf1402d
commit
ba1c49028f
|
@ -20,5 +20,5 @@
|
|||
#pragma once
|
||||
|
||||
void bsc_nat_fsm_alloc(struct bsc_nat *bsc_nat);
|
||||
void bsc_nat_fsm_start(struct bsc_nat *bsc_nat);
|
||||
int bsc_nat_fsm_start(struct bsc_nat *bsc_nat);
|
||||
void bsc_nat_fsm_stop(struct bsc_nat *bsc_nat);
|
||||
|
|
|
@ -474,9 +474,18 @@ void bsc_nat_fsm_alloc(struct bsc_nat *bsc_nat)
|
|||
OSMO_ASSERT(bsc_nat->fi);
|
||||
}
|
||||
|
||||
void bsc_nat_fsm_start(struct bsc_nat *bsc_nat)
|
||||
int bsc_nat_fsm_start(struct bsc_nat *bsc_nat)
|
||||
{
|
||||
osmo_fsm_inst_dispatch(bsc_nat->fi, BSC_NAT_FSM_EV_START, NULL);
|
||||
int rc = osmo_fsm_inst_dispatch(bsc_nat->fi, BSC_NAT_FSM_EV_START, NULL);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
/* st_starting_on_enter() doesn't change to STARTED if e.g. vty config
|
||||
* is incomplete */
|
||||
if (bsc_nat->fi->state != BSC_NAT_FSM_ST_STARTED)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bsc_nat_fsm_stop(struct bsc_nat *bsc_nat)
|
||||
|
|
|
@ -198,7 +198,8 @@ int main(int argc, char **argv)
|
|||
main_vty_init(argc, argv);
|
||||
signal_handler_init();
|
||||
|
||||
bsc_nat_fsm_start(g_bsc_nat);
|
||||
if (bsc_nat_fsm_start(g_bsc_nat) < 0)
|
||||
exit(1);
|
||||
|
||||
if (msc_alloc_from_addr_book() < 0)
|
||||
exit(1);
|
||||
|
|
Loading…
Reference in New Issue