aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-29 13:33:44 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-29 13:33:44 +0100
commit5f9be1ed5ec105d80182e3c6542aafdd5debb37f (patch)
tree20361896ef029d3cf463a8701822a98ea5f45064
parentae937129773c5a27a8fda7fcde0b6476db37b85e (diff)
hnb-test: make hnb-gw address configurable
-rw-r--r--src/tests/hnb-test.c9
-rw-r--r--src/tests/hnb-test.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/tests/hnb-test.c b/src/tests/hnb-test.c
index 6a1a667..77a04c3 100644
--- a/src/tests/hnb-test.c
+++ b/src/tests/hnb-test.c
@@ -69,6 +69,7 @@
static void *tall_hnb_ctx;
struct hnb_test g_hnb_test = {
+ .gw_addr = "127.0.0.1",
.gw_port = IUH_DEFAULT_SCTP_PORT,
};
@@ -790,10 +791,11 @@ static void handle_options(int argc, char **argv)
int idx = 0, c;
static const struct option long_options[] = {
{ "ues", 1, 0, 'u' },
+ { "gw-addr", 1, 0, 'g' },
{ 0, 0, 0, 0 },
};
- c = getopt_long(argc, argv, "u:", long_options, &idx);
+ c = getopt_long(argc, argv, "u:g:", long_options, &idx);
if (c == -1)
break;
@@ -802,6 +804,9 @@ static void handle_options(int argc, char **argv)
case 'u':
g_hnb_test.ues = atoi(optarg);
break;
+ case 'g':
+ g_hnb_test.gw_addr = optarg;
+ break;
}
}
}
@@ -832,7 +837,7 @@ int main(int argc, char **argv)
g_hnb_test.wqueue.write_cb = hnb_write_cb;
rc = osmo_sock_init_ofd(&g_hnb_test.wqueue.bfd, AF_INET, SOCK_STREAM,
- IPPROTO_SCTP, "127.0.0.1",
+ IPPROTO_SCTP, g_hnb_test.gw_addr,
g_hnb_test.gw_port, OSMO_SOCK_F_CONNECT);
if (rc < 0) {
perror("Error connecting to Iuh port");
diff --git a/src/tests/hnb-test.h b/src/tests/hnb-test.h
index f58c177..4af50a7 100644
--- a/src/tests/hnb-test.h
+++ b/src/tests/hnb-test.h
@@ -49,6 +49,7 @@ struct hnbtest_chan {
};
struct hnb_test {
+ const char *gw_addr;
uint16_t gw_port;
/*! SCTP listen socket for incoming connections */
struct osmo_fd conn_fd;