aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-04-13 18:56:13 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-04-13 18:56:13 +0200
commit5cde92cb0e447ef9d415918c5194c3e65282ab28 (patch)
tree19518ce48245477d422d61ddc6b3bc01545bfd60 /openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
parent06009c8d5a251e3803259ca63eec18970e2554a7 (diff)
nat: And out the skip_indicator/transaction id from the gsm48 header
We need to and out the protocol discriminator as call control might have use transactions. This has only failed for the USSD filter so far as this must deal with transactions.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_utils.c')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index 4258364fe..4e7286e6f 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -500,7 +500,7 @@ int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
struct gsm48_hdr *hdr48;
int hdr48_len;
int len;
- uint8_t msg_type;
+ uint8_t msg_type, proto;
*con_type = NAT_CON_TYPE_NONE;
*imsi = NULL;
@@ -538,18 +538,19 @@ int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
hdr48 = (struct gsm48_hdr *) TLVP_VAL(&tp, GSM0808_IE_LAYER_3_INFORMATION);
+ proto = hdr48->proto_discr & 0x0f;
msg_type = hdr48->msg_type & 0xbf;
- if (hdr48->proto_discr == GSM48_PDISC_MM &&
+ if (proto == GSM48_PDISC_MM &&
msg_type == GSM48_MT_MM_LOC_UPD_REQUEST) {
*con_type = NAT_CON_TYPE_LU;
return _cr_check_loc_upd(bsc, &hdr48->data[0], hdr48_len - sizeof(*hdr48), imsi);
- } else if (hdr48->proto_discr == GSM48_PDISC_MM &&
+ } else if (proto == GSM48_PDISC_MM &&
msg_type == GSM48_MT_MM_CM_SERV_REQ) {
*con_type = NAT_CON_TYPE_CM_SERV_REQ;
return _cr_check_cm_serv_req(bsc, &hdr48->data[0],
hdr48_len - sizeof(*hdr48),
con_type, imsi);
- } else if (hdr48->proto_discr == GSM48_PDISC_RR &&
+ } else if (proto == GSM48_PDISC_RR &&
msg_type == GSM48_MT_RR_PAG_RESP) {
*con_type = NAT_CON_TYPE_PAG_RESP;
return _cr_check_pag_resp(bsc, &hdr48->data[0], hdr48_len - sizeof(*hdr48), imsi);
@@ -583,7 +584,7 @@ int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg,
struct sccp_connections *con, struct bsc_nat_parsed *parsed)
{
uint32_t len;
- uint8_t msg_type;
+ uint8_t msg_type, proto;
struct gsm48_hdr *hdr48;
if (con->imsi_checked)
@@ -597,8 +598,9 @@ int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg,
if (!hdr48)
return -1;
+ proto = hdr48->proto_discr & 0x0f;
msg_type = hdr48->msg_type & 0xbf;
- if (hdr48->proto_discr == GSM48_PDISC_MM &&
+ if (proto == GSM48_PDISC_MM &&
msg_type == GSM48_MT_MM_ID_RESP) {
return _dt_check_id_resp(bsc, &hdr48->data[0], len - sizeof(*hdr48), con);
} else {
@@ -745,7 +747,7 @@ struct msgb *bsc_nat_rewrite_setup(struct bsc_nat *nat, struct msgb *msg, struct
struct tlv_parsed tp;
struct gsm48_hdr *hdr48;
uint32_t len;
- uint8_t msg_type;
+ uint8_t msg_type, proto;
unsigned int payload_len;
struct gsm_mncc_number called;
struct msg_entry *entry;
@@ -771,8 +773,9 @@ struct msgb *bsc_nat_rewrite_setup(struct bsc_nat *nat, struct msgb *msg, struct
if (!hdr48)
return msg;
+ proto = hdr48->proto_discr & 0x0f;
msg_type = hdr48->msg_type & 0xbf;
- if (hdr48->proto_discr != GSM48_PDISC_CC ||
+ if (proto != GSM48_PDISC_CC ||
msg_type != GSM48_MT_CC_SETUP)
return msg;