nat: Make the queue routine work on any write_queue
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 7ac175d..682447a 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -297,6 +297,7 @@
 
 
 int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
+int bsc_do_write(struct write_queue *queue, struct msgb *msg, int id);
 
 /* IMSI allow/deny handling */
 void bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv);
diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c
index 4fda517..9c155cc 100644
--- a/openbsc/src/nat/bsc_nat_utils.c
+++ b/openbsc/src/nat/bsc_nat_utils.c
@@ -265,10 +265,15 @@
 
 int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int proto)
 {
+	return bsc_do_write(&bsc->write_queue, msg, proto);
+}
+
+int bsc_do_write(struct write_queue *queue, struct msgb *msg, int proto)
+{
 	/* prepend the header */
 	ipaccess_prepend_header(msg, proto);
 
-	if (write_queue_enqueue(&bsc->write_queue, msg) != 0) {
+	if (write_queue_enqueue(queue, msg) != 0) {
 		LOGP(DINP, LOGL_ERROR, "Failed to enqueue the write.\n");
 		msgb_free(msg);
 		return -1;