aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_msc_ip.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-02-09 16:28:32 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-02-09 16:30:38 +0100
commitd838951302d8c84220325517a902094d40cf6512 (patch)
tree77ea1a3fed101dd5261ffc167ddacc723896c10b /openbsc/src/bsc_msc_ip.c
parentf8e1b45a788d459ff1c44147b8a8833d72485a28 (diff)
[nat] Implement token based identification.
Based on the token the NAT/MUX is capable of figuring out which LAC this BSC is supposed to satisfy. This will be needed for messages like paging that can be done by LAC.
Diffstat (limited to 'openbsc/src/bsc_msc_ip.c')
-rw-r--r--openbsc/src/bsc_msc_ip.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index 54ed96b2a..518fbed26 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -610,6 +610,33 @@ static void initialize_if_needed(void)
}
}
+static void send_id_get_response(int fd)
+{
+ struct msgb *msg;
+ if (!bsc_gsmnet) {
+ LOGP(DMSC, LOGL_ERROR, "The network is not initialized yet.\n");
+ return;
+ }
+
+ if (!bsc_gsmnet->bsc_token) {
+ LOGP(DMSC, LOGL_ERROR, "The bsc token is not set.\n");
+ return;
+ }
+
+ msg = msgb_alloc_headroom(4096, 128, "id resp");
+
+ msg->l2h = msgb_v_put(msg, IPAC_MSGT_ID_RESP);
+ msgb_l16tv_put(msg, strlen(bsc_gsmnet->bsc_token) + 1,
+ IPAC_IDTAG_UNITNAME, (u_int8_t *) bsc_gsmnet->bsc_token);
+ ipaccess_prepend_header(msg, IPAC_PROTO_IPACCESS);
+
+ if (write(fd, msg->data, msg->len) != msg->len) {
+ LOGP(DMSC, LOGL_ERROR, "Short write.\n");
+ }
+
+ msgb_free(msg);
+}
+
/*
* callback with IP access data
*/
@@ -636,9 +663,13 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd, unsigned int what)
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_if_needed();
- else if (hh->proto == IPAC_PROTO_SCCP)
+ if (hh->proto == IPAC_PROTO_IPACCESS) {
+ if (msg->l2h[0] == IPAC_MSGT_ID_ACK)
+ initialize_if_needed();
+ else if (msg->l2h[0] == IPAC_MSGT_ID_GET) {
+ send_id_get_response(bfd->fd);
+ }
+ } else if (hh->proto == IPAC_PROTO_SCCP)
sccp_system_incoming(msg);
return 0;