aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-07-13 10:14:28 +0200
committerHarald Welte <laforge@gnumonks.org>2015-11-15 14:15:19 +0100
commitf828a0e06d0321a02041cd578ab9a8a43cf955df (patch)
treeb407dc69e3fc71c1cb7cd5d5739e1c1fb7f0f91a
parent1712c6fec92457c4a20e0896b3b2a8aae8ba18c2 (diff)
ganc: actually read + use settings from the config file
-rw-r--r--openbsc/doc/examples/osmo-ganc/osmo-ganc.cfg14
-rw-r--r--openbsc/src/osmo-ganc/ganc_server.c9
-rw-r--r--openbsc/src/osmo-ganc/main.c7
3 files changed, 28 insertions, 2 deletions
diff --git a/openbsc/doc/examples/osmo-ganc/osmo-ganc.cfg b/openbsc/doc/examples/osmo-ganc/osmo-ganc.cfg
new file mode 100644
index 000000000..d428c3ce8
--- /dev/null
+++ b/openbsc/doc/examples/osmo-ganc/osmo-ganc.cfg
@@ -0,0 +1,14 @@
+!
+! OsmoGANC (0.12.0.18-68de-dirty) configuration saved from vty
+!!
+password foo
+!
+!
+line vty
+ no login
+!
+network
+ bts 0
+ segw hostname segw.uma.sysmocom.de
+ ganc hostname ganc-laforge.gnumonks.org
+ ganc port 14001
diff --git a/openbsc/src/osmo-ganc/ganc_server.c b/openbsc/src/osmo-ganc/ganc_server.c
index 8cccb3a5f..e799ffdc9 100644
--- a/openbsc/src/osmo-ganc/ganc_server.c
+++ b/openbsc/src/osmo-ganc/ganc_server.c
@@ -276,6 +276,8 @@ static int tx_csr_request_acc(struct gan_peer *peer)
static int rx_rc_discovery_req(struct gan_peer *peer, struct msgb *msg,
struct tlv_parsed *tp)
{
+ struct ganc_bts *bts;
+
if (TLVP_PRESENT(tp, GA_IE_MI)) {
gsm48_mi_to_string(peer->imsi, sizeof(peer->imsi),
TLVP_VAL(tp, GA_IE_MI), TLVP_LEN(tp, GA_IE_MI));
@@ -286,8 +288,11 @@ static int rx_rc_discovery_req(struct gan_peer *peer, struct msgb *msg,
if (TLVP_PRESENT(tp, GA_IE_GAN_CM) && TLVP_LEN(tp, GA_IE_GAN_CM) >=2)
memcpy(peer->gan_classmark, TLVP_VAL(tp, GA_IE_GAN_CM), 2);
- return tx_unc_disco_acc(peer, "segw.uma.sysmocom.de",
- "ganc-laforge.gnumonks.org");
+ /* FIXME: we need to select the virtual BTS based on MAC address
+ * and/or ESSID of the AP */
+ bts = peer->bts = g_ganc_bts;
+
+ return tx_unc_disco_acc(peer, bts->segw_host, bts->ganc_host);
}
/* 10.1.5 GA-RC REGISTER REQUEST */
diff --git a/openbsc/src/osmo-ganc/main.c b/openbsc/src/osmo-ganc/main.c
index 12d69b022..bf772dc97 100644
--- a/openbsc/src/osmo-ganc/main.c
+++ b/openbsc/src/osmo-ganc/main.c
@@ -34,6 +34,7 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/talloc.h>
#include <osmocom/vty/vty.h>
+#include <osmocom/vty/telnet_interface.h>
#include <osmocom/sccp/sccp.h>
@@ -201,6 +202,12 @@ int main(int argc, char **argv)
/* initialize SCCP */
sccp_set_log_area(DSCCP);
+ struct telnet_connection dummy_conn;
+ rc = vty_read_config_file(config_file, &dummy_conn);
+ if (rc < 0) {
+ fprintf(stderr, "Failed to parse the config file: '%s'\n", config_file);
+ return rc;
+ }
ganc_server_start(NULL, 14001);