aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_nat.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-06 00:48:36 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-06 00:48:36 +0800
commit0c41b6933efc3dcc57bb8cd0151640306abd95ce (patch)
tree95d81521b797131cd82ec41cc1d432aedc43252a /openbsc/src/nat/bsc_nat.c
parente8e41e611f04d02571a628c4f84beaf94548bba9 (diff)
nat: Possible crash fix, only filter non local connections
For local connections con_msc is not set and sending a RLSD to the network would have ended up in a segfault.
Diffstat (limited to 'openbsc/src/nat/bsc_nat.c')
-rw-r--r--openbsc/src/nat/bsc_nat.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 2aa2d7369..48407b9a8 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -839,17 +839,20 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
case SCCP_MSG_TYPE_IT:
con = patch_sccp_src_ref_to_msc(msg, parsed, bsc);
if (con) {
- filter = bsc_nat_filter_dt(bsc, msg, con, parsed);
- if (filter < 0) {
- bsc_stat_reject(filter, bsc, 1);
- bsc_send_con_release(bsc, con);
- con = NULL;
- goto exit2;
- } else {
- con_bsc = con->bsc;
- con_msc = con->msc_con;
- con_filter = con->con_local;
+ /* only filter non local connections */
+ if (!con->con_local) {
+ filter = bsc_nat_filter_dt(bsc, msg, con, parsed);
+ if (filter < 0) {
+ bsc_stat_reject(filter, bsc, 1);
+ bsc_send_con_release(bsc, con);
+ con = NULL;
+ goto exit2;
+ }
}
+
+ con_bsc = con->bsc;
+ con_msc = con->msc_con;
+ con_filter = con->con_local;
}
break;
case SCCP_MSG_TYPE_RLC: