summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-09-09 02:40:41 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2011-09-09 02:58:22 +0200
commit85d70bf9694acf7f9173f035aed8ac185f23cc77 (patch)
treedd12c64df8c2ebb24d8c6d89de10fe4bcf1f3f5a
parent3facb1cafced3d0062d2081500356774242ca94a (diff)
src: check for error returned by controlif_setup()
Bail out in case that we cannot bind the telnet interface.
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_main.c6
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c6
-rw-r--r--openbsc/src/osmo-nitb/bsc_hack.c5
3 files changed, 14 insertions, 3 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c
index 9a799c0c6..fe6526de8 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_main.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c
@@ -422,7 +422,11 @@ int main(int argc, char **argv)
}
bsc_api_init(bsc_gsmnet, osmo_bsc_api());
- controlif_setup(bsc_gsmnet, 4249);
+ if (controlif_setup(bsc_gsmnet, 4249) < 0) {
+ fprintf(stderr, "CTRL: Cannot bind to port 4249\n");
+ exit(1);
+ }
+
ctrl_cmd_install(CTRL_NODE_NET, &cmd_net_loc);
ctrl_cmd_install(CTRL_NODE_NET, &cmd_net_rf_lock);
ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_rf_lock);
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 295535a19..326d04ed7 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -1760,7 +1760,11 @@ int main(int argc, char **argv)
exit(1);
}
- controlif_setup(NULL, 4250);
+ if (controlif_setup(NULL, 4250) < 0) {
+ fprintf(stderr, "CTRL: Cannot bind to port 4250\n");
+ exit(1);
+ }
+
ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_fwd_cmd);
nat->msc_con->connection_loss = msc_connection_was_lost;
diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c
index 001d8f9a4..5f9b7e54b 100644
--- a/openbsc/src/osmo-nitb/bsc_hack.c
+++ b/openbsc/src/osmo-nitb/bsc_hack.c
@@ -254,7 +254,10 @@ int main(int argc, char **argv)
exit(1);
bsc_api_init(bsc_gsmnet, msc_bsc_api());
- controlif_setup(bsc_gsmnet, 4249);
+ if (controlif_setup(bsc_gsmnet, 4249) < 0) {
+ fprintf(stderr, "CTRL: Cannot bind to port 4249\n");
+ exit(1);
+ }
/* seed the PRNG */
srand(time(NULL));