diff options
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-04-24 11:26:44 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-04-29 20:44:42 +0200
commit84b033f8c76167d01c0fc921d9004edba5e4d7c2 (patch)
parente84dd98d2685112672f60e002e45dfcb4dd2b611 (diff)
sysmobts: Initialize the NM signal handler only once in a mixed network
Make sure that the bts_ipa_nm_sig_cb is only installed once. In a nanoBTS + sysmoBTS network the _start method will be called for each mode leading to the handler being registered twice. Make sure that there is only one handler registered by unregistering a previously installed handler. The osmo_signal_unregister_handler will remove 0 or 1 handlers per invocation and we only add one handler in this file so it is always balanced.
1 files changed, 2 insertions, 1 deletions
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
index cebb7ae82..ebbd88d0c 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
@@ -439,7 +439,7 @@ static int sw_activ_rep(struct msgb *mb)
/* Callback function to be called every time we receive a signal from NM */
-int bts_ipa_nm_sig_cb(unsigned int subsys, unsigned int signal,
+static int bts_ipa_nm_sig_cb(unsigned int subsys, unsigned int signal,
void *handler_data, void *signal_data)
if (subsys != SS_NM)
@@ -461,6 +461,7 @@ struct gsm_network *ipaccess_gsmnet;
static int bts_model_nanobts_start(struct gsm_network *net)
+ osmo_signal_unregister_handler(SS_NM, bts_ipa_nm_sig_cb, NULL);
osmo_signal_register_handler(SS_NM, bts_ipa_nm_sig_cb, NULL);
ipaccess_gsmnet = net;
return 0;