From 99ae401e490e60fc07bef7eacc478be7bdcc9f5a Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 15 Dec 2018 17:36:41 +0000 Subject: vty: Make TCP port configurable and introduce telnet_init_default Extend the vty_bind_cmd VTY command to allow to optionally specify a port in addition to the IPv4 address. Introduce telnet_init_default to relieve client code from having to query the bind IPv4 address (and now the TCP port). Instead a client only needs to pass the default TCP port to use. Client code should use it like: int rc = telnet_init_default(ctx, priv, OSMO_VTY_PORT_SGSN); Change-Id: Id5fb2faaf4311bd7284ee870526a6f87b7e260f3 --- src/vty/telnet_interface.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/vty/telnet_interface.c') diff --git a/src/vty/telnet_interface.c b/src/vty/telnet_interface.c index 47c45fcf..e090e17e 100644 --- a/src/vty/telnet_interface.c +++ b/src/vty/telnet_interface.c @@ -105,6 +105,18 @@ int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port) return 0; } +/*! Initializes telnet based VTY interface using the configured bind addr/port. + * \param[in] tall_ctx \ref talloc context + * \param[in] priv private data to be passed to callback + * \param[in] default_port TCP port number to bind to if not explicitely configured + */ +int telnet_init_default(void *tall_ctx, void *priv, int default_port) +{ + return telnet_init_dynif(tall_ctx, priv, vty_get_bind_addr(), + vty_get_bind_port(default_port)); +} + + extern struct host host; /*! close a telnet connection */ -- cgit v1.2.3