aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-26 07:41:54 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-26 07:41:54 +0100
commit097c82b2bc4f1afa00b19fc2bdac79cc7845488e (patch)
tree4db923f95b71a872864811615105baa6ba002736
parentabaeb3f55f9fbb8e47f37942e97a32bc3fcc9743 (diff)
nat: Stop using the input/ipaccess.c method as it will write directly
We want to write everything through the write queue, it seemed the easiest to copy the bytes here and feed the data into the bsc_write method.
-rw-r--r--openbsc/src/nat/bsc_nat.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 282d63228..e2552c4f3 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -138,6 +138,32 @@ static int send_reset_ack(struct bsc_connection *bsc)
return bsc_write(bsc, gsm_reset_ack, sizeof(gsm_reset_ack));
}
+static int send_id_ack(struct bsc_connection *bsc)
+{
+ static const u_int8_t id_ack[] = {
+ 0, 1, IPAC_PROTO_IPACCESS, IPAC_MSGT_ID_ACK
+ };
+
+ return bsc_write(bsc, id_ack, sizeof(id_ack));
+}
+
+static int send_id_req(struct bsc_connection *bsc)
+{
+ static const u_int8_t id_req[] = {
+ 0, 17, IPAC_PROTO_IPACCESS, IPAC_MSGT_ID_GET,
+ 0x01, IPAC_IDTAG_UNIT,
+ 0x01, IPAC_IDTAG_MACADDR,
+ 0x01, IPAC_IDTAG_LOCATION1,
+ 0x01, IPAC_IDTAG_LOCATION2,
+ 0x01, IPAC_IDTAG_EQUIPVERS,
+ 0x01, IPAC_IDTAG_SWVERSION,
+ 0x01, IPAC_IDTAG_UNITNAME,
+ 0x01, IPAC_IDTAG_SERNR,
+ };
+
+ return bsc_write(bsc, id_req, sizeof(id_req));
+}
+
/*
* SCCP patching below
*/
@@ -637,8 +663,8 @@ static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what)
LOGP(DNAT, LOGL_INFO, "Registered new BSC\n");
llist_add(&bsc->list_entry, &nat->bsc_connections);
- ipaccess_send_id_ack(bsc->write_queue.bfd.fd);
- ipaccess_send_id_req(bsc->write_queue.bfd.fd);
+ send_id_ack(bsc);
+ send_id_req(bsc);
/*
* start the hangup timer