aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/nat/bsc_nat.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-05-15 00:14:58 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:19 +0800
commite635dab52fd8351cb3af2e120580374ae6a38065 (patch)
treed7227333b651953f2fb23201dd3dc8253163bf31 /openbsc/src/nat/bsc_nat.c
parentf76e7ef5e1528a33a7f314e78a5b029a76ff2282 (diff)
[nat] Add a token to the nat config and handle ID GET
This allows to chain a nat with a nat by answering to the id get code and sending the token.
Diffstat (limited to 'openbsc/src/nat/bsc_nat.c')
-rw-r--r--openbsc/src/nat/bsc_nat.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 4a0a15bfa..daed23987 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -260,6 +260,16 @@ static void initialize_msc_if_needed()
msc_send_reset(nat->msc_con);
}
+static void send_id_get_response()
+{
+ struct msgb *msg = bsc_msc_id_get_resp(nat->token);
+ if (!msg)
+ return;
+
+ ipaccess_prepend_header(msg, IPAC_PROTO_IPACCESS);
+ queue_for_msc(nat->msc_con, msg);
+}
+
/*
* Currently we are lacking refcounting so we need to copy each message.
*/
@@ -455,9 +465,12 @@ static int ipaccess_msc_read_cb(struct bsc_fd *bfd)
ipaccess_rcvmsg_base(msg, bfd);
/* initialize the networking. This includes sending a GSM08.08 message */
- if (hh->proto == IPAC_PROTO_IPACCESS && msg->l2h[0] == IPAC_MSGT_ID_ACK)
- initialize_msc_if_needed();
- else if (hh->proto == IPAC_PROTO_SCCP)
+ if (hh->proto == IPAC_PROTO_IPACCESS) {
+ if (msg->l2h[0] == IPAC_MSGT_ID_ACK)
+ initialize_msc_if_needed();
+ else if (msg->l2h[0] == IPAC_MSGT_ID_GET)
+ send_id_get_response();
+ } else if (hh->proto == IPAC_PROTO_SCCP)
forward_sccp_to_bts(msg);
msgb_free(msg);