diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-10-06 00:24:28 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-10-06 00:24:28 +0800 |
commit | e8e41e611f04d02571a628c4f84beaf94548bba9 (patch) | |
tree | d2c784dd6ec7349e13aee54b97ad48cfe8b0a8fc /openbsc | |
parent | 0c35b5bd7988ed09677cb72fa35eec270185309c (diff) |
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...
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/nat/bsc_nat.c | 8 |
1 files changed, 7 insertions, 1 deletions
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); |