From e8e41e611f04d02571a628c4f84beaf94548bba9 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 6 Oct 2010 00:24:28 +0800 Subject: nat: Work around trying to forward a msg to a msc that does not exist Instead of segfaulting warn the user that the MSC Connection does not exist... --- openbsc/src/nat/bsc_nat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'openbsc/src/nat/bsc_nat.c') diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index da85456a8..2aa2d7369 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -103,9 +103,15 @@ int nm_state_event(enum nm_evt evt, uint8_t obj_class, void *obj, void input_event(int event, enum e1inp_sign_type type, struct gsm_bts_trx *trx) {} -static void queue_for_msc(struct bsc_msc_connection *con, struct msgb *msg) __attribute__((nonnull (1, 2))); static void queue_for_msc(struct bsc_msc_connection *con, struct msgb *msg) { + if (!con) { + LOGP(DINP, LOGL_ERROR, "No MSC Connection assigned. Check your code.\n"); + msgb_free(msg); + return; + } + + if (write_queue_enqueue(&con->write_queue, msg) != 0) { LOGP(DINP, LOGL_ERROR, "Failed to enqueue the write.\n"); msgb_free(msg); -- cgit v1.2.3