osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bsc-nat/+/27708 )
Change subject: Proper exit if bsc_nat_fsm fails to start
......................................................................
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
---
M include/osmocom/bsc_nat/bsc_nat_fsm.h
M src/osmo-bsc-nat/bsc_nat_fsm.c
M src/osmo-bsc-nat/main.c
3 files changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc-nat refs/changes/08/27708/1
diff --git a/include/osmocom/bsc_nat/bsc_nat_fsm.h
b/include/osmocom/bsc_nat/bsc_nat_fsm.h
index a2becfb..483658d 100644
--- a/include/osmocom/bsc_nat/bsc_nat_fsm.h
+++ b/include/osmocom/bsc_nat/bsc_nat_fsm.h
@@ -22,3 +22,4 @@
void bsc_nat_fsm_alloc(struct bsc_nat *bsc_nat);
void bsc_nat_fsm_start(struct bsc_nat *bsc_nat);
void bsc_nat_fsm_stop(struct bsc_nat *bsc_nat);
+bool bsc_nat_fsm_is_started(struct bsc_nat *bsc_nat);
diff --git a/src/osmo-bsc-nat/bsc_nat_fsm.c b/src/osmo-bsc-nat/bsc_nat_fsm.c
index 30486ce..33439b8 100644
--- a/src/osmo-bsc-nat/bsc_nat_fsm.c
+++ b/src/osmo-bsc-nat/bsc_nat_fsm.c
@@ -483,3 +483,8 @@
{
osmo_fsm_inst_dispatch(bsc_nat->fi, BSC_NAT_FSM_EV_STOP, NULL);
}
+
+bool bsc_nat_fsm_is_started(struct bsc_nat *bsc_nat)
+{
+ return bsc_nat->fi->state == BSC_NAT_FSM_ST_STARTED;
+}
diff --git a/src/osmo-bsc-nat/main.c b/src/osmo-bsc-nat/main.c
index 6cb1e0f..6704565 100644
--- a/src/osmo-bsc-nat/main.c
+++ b/src/osmo-bsc-nat/main.c
@@ -199,6 +199,9 @@
signal_handler_init();
bsc_nat_fsm_start(g_bsc_nat);
+ if (!bsc_nat_fsm_is_started(g_bsc_nat)) {
+ exit(1);
+ }
if (msc_alloc_from_addr_book() < 0)
exit(1);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc-nat/+/27708
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc-nat
Gerrit-Branch: master
Gerrit-Change-Id: Ia8bbe6ae908d5c3ce49f71b43c950497aeebb6d6
Gerrit-Change-Number: 27708
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange