nat: Create a method to determine if any MSC is connected.
In the future we will have multiple MSC connections so we will
need to figure if any of them is active.
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index c5a9258..11d1f23 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -338,4 +338,6 @@
struct bsc_nat_acc_lst_entry *bsc_nat_acc_lst_entry_create(struct bsc_nat_acc_lst *);
+int bsc_nat_msc_is_connected(struct bsc_nat *nat);
+
#endif
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index 7c4a03d..ef3f9a9 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -883,7 +883,7 @@
/*
* if we are not connected to a msc... just close the socket
*/
- if (!nat->msc_con->is_connected) {
+ if (!bsc_nat_msc_is_connected(nat)) {
LOGP(DNAT, LOGL_NOTICE, "Disconnecting BSC due lack of MSC connection.\n");
close(fd);
return 0;
diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c
index a96cd01..39de817 100644
--- a/openbsc/src/nat/bsc_nat_utils.c
+++ b/openbsc/src/nat/bsc_nat_utils.c
@@ -23,6 +23,7 @@
*/
#include <openbsc/bsc_nat.h>
+#include <openbsc/bsc_msc.h>
#include <openbsc/gsm_data.h>
#include <openbsc/debug.h>
#include <openbsc/ipaccess.h>
@@ -508,3 +509,8 @@
llist_add_tail(&entry->list, &lst->fltr_list);
return entry;
}
+
+int bsc_nat_msc_is_connected(struct bsc_nat *nat)
+{
+ return nat->msc_con->is_connected;
+}