summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/smpp_openbsc.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-03-13 15:05:26 +0100
committerHarald Welte <laforge@gnumonks.org>2013-03-13 15:30:48 +0100
commit76afa16d049a6c83555c6e99f0cec20b00d9536c (patch)
tree0dcca304f23aa36ccf0c88413c5ea71749325fec /openbsc/src/libmsc/smpp_openbsc.c
parent8b29180cad875b396288a22fb252e158fa2a060a (diff)
SMPP: Fix crash on delivery of incoming SUBMIT-SM
As bsc_gsmnet is NULL at the time we call smpp_openbsc_init(), we later run into segfaults with subscribers that don't have a subscr->net set. However, we cannot delay smpp_openbsc_init() until after bsc_bootstrap_network(), as we then fail to parse the SMPP specific VTY/config file options...
Diffstat (limited to 'openbsc/src/libmsc/smpp_openbsc.c')
-rw-r--r--openbsc/src/libmsc/smpp_openbsc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index e83fb75e9..585f93976 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -434,18 +434,16 @@ struct smsc *smsc_from_vty(struct vty *v)
}
/*! \brief Initialize the OpenBSC SMPP interface */
-int smpp_openbsc_init(struct gsm_network *net, uint16_t port)
+int smpp_openbsc_init(void *ctx, uint16_t port)
{
- struct smsc *smsc = talloc_zero(net, struct smsc);
+ struct smsc *smsc = talloc_zero(ctx, struct smsc);
int rc;
- smsc->priv = net;
-
rc = smpp_smsc_init(smsc, port);
if (rc < 0)
talloc_free(smsc);
- osmo_signal_register_handler(SS_SMS, smpp_sms_cb, net);
+ osmo_signal_register_handler(SS_SMS, smpp_sms_cb, smsc);
osmo_signal_register_handler(SS_SUBSCR, smpp_subscr_cb, smsc);
g_smsc = smsc;
@@ -454,3 +452,8 @@ int smpp_openbsc_init(struct gsm_network *net, uint16_t port)
return rc;
}
+
+void smpp_openbsc_set_net(struct gsm_network *net)
+{
+ g_smsc->priv = net;
+}