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
This commit is contained in:
Harald Welte 2021-04-24 16:09:09 +02:00
parent dd1389c3d3
commit 8b73a2a530
2 changed files with 13 additions and 12 deletions

View File

@ -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);

View File

@ -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 */