aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-04-24 16:09:09 +0200
committerHarald Welte <laforge@osmocom.org>2021-04-24 16:09:09 +0200
commit8b73a2a5307b4440f1e196329a9a1f0423e41762 (patch)
tree1a53aaa6e8b3572978d15e178a2994a9f0728662
parentdd1389c3d3e69fbb55669df9c9f63567bea8522a (diff)
vty: call telnet_init_dynif() after config file is read
In case the config file specifies a vty bind address, we must read it before we start the telnet server. Change-Id: I44561754d4beaad5c74cb66994ca4ef38960ea78
-rw-r--r--src/osmo_client_main.c13
-rw-r--r--src/osmo_server_main.c12
2 files changed, 13 insertions, 12 deletions
diff --git a/src/osmo_client_main.c b/src/osmo_client_main.c
index 0951115..1ab24c3 100644
--- a/src/osmo_client_main.c
+++ b/src/osmo_client_main.c
@@ -259,12 +259,6 @@ int main(int argc, char **argv)
osmo_tls_init();
- rc = telnet_init_dynif(tall_cli_ctx, NULL, vty_get_bind_addr(), OSMO_VTY_PORT_PCAP_CLIENT);
- if (rc < 0) {
- LOGP(DCLIENT, LOGL_ERROR, "Failed to bind telnet interface\n");
- exit(1);
- }
-
pcap_client = osmo_pcap_client_alloc(tall_cli_ctx);
if (!pcap_client) {
LOGP(DCLIENT, LOGL_ERROR, "Failed to allocate osmo_pcap_client.\n");
@@ -289,6 +283,13 @@ int main(int argc, char **argv)
exit(1);
}
+ rc = telnet_init_dynif(tall_cli_ctx, NULL, vty_get_bind_addr(), OSMO_VTY_PORT_PCAP_CLIENT);
+ if (rc < 0) {
+ LOGP(DCLIENT, LOGL_ERROR, "Failed to bind telnet interface\n");
+ exit(1);
+ }
+
+
/* attempt to connect to the remote */
if (pcap_client->conn.srv_ip && pcap_client->conn.srv_port > 0)
osmo_client_connect(&pcap_client->conn);
diff --git a/src/osmo_server_main.c b/src/osmo_server_main.c
index b5f573c..f198b58 100644
--- a/src/osmo_server_main.c
+++ b/src/osmo_server_main.c
@@ -271,12 +271,6 @@ int main(int argc, char **argv)
osmo_tls_init();
- rc = telnet_init_dynif(tall_srv_ctx, NULL, vty_get_bind_addr(), OSMO_VTY_PORT_PCAP_SERVER);
- if (rc < 0) {
- LOGP(DCLIENT, LOGL_ERROR, "Failed to bind telnet interface\n");
- exit(1);
- }
-
pcap_server = talloc_zero(tall_srv_ctx, struct osmo_pcap_server);
if (!pcap_server) {
LOGP(DSERVER, LOGL_ERROR, "Failed to allocate osmo_pcap_server.\n");
@@ -299,6 +293,12 @@ int main(int argc, char **argv)
exit(1);
}
+ rc = telnet_init_dynif(tall_srv_ctx, NULL, vty_get_bind_addr(), OSMO_VTY_PORT_PCAP_SERVER);
+ if (rc < 0) {
+ LOGP(DCLIENT, LOGL_ERROR, "Failed to bind telnet interface\n");
+ exit(1);
+ }
+
osmo_tls_server_init(pcap_server);
/* attempt to connect to the remote */