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.
This commit is contained in:
Holger Hans Peter Freyther 2010-10-06 00:48:36 +08:00
parent e8e41e611f
commit 0c41b6933e
1 changed files with 13 additions and 10 deletions

View File

@ -839,17 +839,20 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
case SCCP_MSG_TYPE_IT: case SCCP_MSG_TYPE_IT:
con = patch_sccp_src_ref_to_msc(msg, parsed, bsc); con = patch_sccp_src_ref_to_msc(msg, parsed, bsc);
if (con) { if (con) {
filter = bsc_nat_filter_dt(bsc, msg, con, parsed); /* only filter non local connections */
if (filter < 0) { if (!con->con_local) {
bsc_stat_reject(filter, bsc, 1); filter = bsc_nat_filter_dt(bsc, msg, con, parsed);
bsc_send_con_release(bsc, con); if (filter < 0) {
con = NULL; bsc_stat_reject(filter, bsc, 1);
goto exit2; bsc_send_con_release(bsc, con);
} else { con = NULL;
con_bsc = con->bsc; goto exit2;
con_msc = con->msc_con; }
con_filter = con->con_local;
} }
con_bsc = con->bsc;
con_msc = con->msc_con;
con_filter = con->con_local;
} }
break; break;
case SCCP_MSG_TYPE_RLC: case SCCP_MSG_TYPE_RLC: