nat: Use the link_id from the original message in the new DTAP message

SMS went from SAPI=3 to SAPI=0 and nobody notices on the NAT->MSC direction.
This commit is contained in:
Holger Hans Peter Freyther 2012-01-10 22:29:35 +01:00
parent c2c0ea700b
commit 951f34b885
2 changed files with 4 additions and 2 deletions

View File

@ -1124,6 +1124,7 @@ struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct b
uint32_t len;
uint8_t msg_type, proto;
struct msgb *new_msg = NULL, *sccp;
uint8_t link_id;
if (!imsi || strlen(imsi) < 5)
return msg;
@ -1138,6 +1139,7 @@ struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct b
if (!hdr48)
return msg;
link_id = msg->l3h[1];
proto = hdr48->proto_discr & 0x0f;
msg_type = hdr48->msg_type & 0xbf;
@ -1150,7 +1152,7 @@ struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct b
return msg;
/* wrap with DTAP, SCCP, then IPA. TODO: Stop copying */
gsm0808_prepend_dtap_header(new_msg, 0);
gsm0808_prepend_dtap_header(new_msg, link_id);
sccp = sccp_create_dt1(parsed->dest_local_ref, new_msg->data, new_msg->len);
talloc_free(new_msg);

View File

@ -109,7 +109,7 @@ static const uint8_t smsc_rewrite[] = {
static const uint8_t smsc_rewrite_patched[] = {
0x00, 0x31, 0xfd, 0x06, 0x01, 0x13, 0x1e, 0x00,
0x01, 0x2a, 0x01, 0x00, 0x27, 0x09, 0x01, 0x24,
0x01, 0x2a, 0x01, 0x03, 0x27, 0x09, 0x01, 0x24,
0x00, 0x0c, 0x00, 0x08, 0x91, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0xf7, 0x17, 0x01, 0x0c, 0x0f,
0x81, 0x00, 0x94, 0x51, 0x87, 0x86, 0x78, 0x46,