nat: Store the msc_con in the data of the bsc_fd

* Stop using nat->msc_con in the read_cb but use the data.
diff --git a/openbsc/src/bsc_msc.c b/openbsc/src/bsc_msc.c
index 42b4c20..c85bf5b 100644
--- a/openbsc/src/bsc_msc.c
+++ b/openbsc/src/bsc_msc.c
@@ -47,6 +47,7 @@
 	fd->when = 0;
 
 	con->is_connected = 0;
+	con->first_contact = 0;
 	con->connection_loss(con);
 }
 
@@ -267,4 +268,4 @@
 	msgb_l16tv_put(msg, strlen(token) + 1,
 			IPAC_IDTAG_UNITNAME, (u_int8_t *) token);
 	return msg;
-}
\ No newline at end of file
+}
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index dc7798b..7c4a03d 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -257,13 +257,13 @@
  * from the MSC and need to be forwarded to
  * a real BSC.
  */
-static void initialize_msc_if_needed()
+static void initialize_msc_if_needed(struct bsc_msc_connection *msc_con)
 {
-	if (nat->first_contact)
+	if (msc_con->first_contact)
 		return;
 
-	nat->first_contact = 1;
-	msc_send_reset(nat->msc_con);
+	msc_con->first_contact = 1;
+	msc_send_reset(msc_con);
 }
 
 static void send_id_get_response(struct bsc_msc_connection *msc_con)
@@ -530,16 +530,19 @@
 static int ipaccess_msc_read_cb(struct bsc_fd *bfd)
 {
 	int error;
+	struct bsc_msc_connection *msc_con;
 	struct msgb *msg = ipaccess_read_msg(bfd, &error);
 	struct ipaccess_head *hh;
 
+	msc_con = (struct bsc_msc_connection *) bfd->data;
+
 	if (!msg) {
 		if (error == 0)
 			LOGP(DNAT, LOGL_FATAL, "The connection the MSC was lost, exiting\n");
 		else
 			LOGP(DNAT, LOGL_ERROR, "Failed to parse ip access message: %d\n", error);
 
-		bsc_msc_lost(nat->msc_con);
+		bsc_msc_lost(msc_con);
 		return -1;
 	}
 
@@ -552,11 +555,11 @@
 	/* initialize the networking. This includes sending a GSM08.08 message */
 	if (hh->proto == IPAC_PROTO_IPACCESS) {
 		if (msg->l2h[0] == IPAC_MSGT_ID_ACK)
-			initialize_msc_if_needed();
+			initialize_msc_if_needed(msc_con);
 		else if (msg->l2h[0] == IPAC_MSGT_ID_GET)
-			send_id_get_response(nat->msc_con);
+			send_id_get_response(msc_con);
 	} else if (hh->proto == IPAC_PROTO_SCCP)
-		forward_sccp_to_bts(nat->msc_con, msg);
+		forward_sccp_to_bts(msc_con, msg);
 
 	msgb_free(msg);
 	return 0;
@@ -1158,6 +1161,7 @@
 	nat->msc_con->connection_loss = msc_connection_was_lost;
 	nat->msc_con->write_queue.read_cb = ipaccess_msc_read_cb;
 	nat->msc_con->write_queue.write_cb = ipaccess_msc_write_cb;;
+	nat->msc_con->write_queue.bfd.data = nat->msc_con;
 	bsc_msc_connect(nat->msc_con);
 
 	/* wait for the BSC */