diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2018-11-21 10:34:58 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2018-11-21 10:36:57 +0700 |
commit | da96b3c0aed7a63772faee91b7056dd0b3d72890 (patch) | |
tree | 7dea071f59df7d40cc9f1d4c622324a6032eab20 /src/host | |
parent | 65110d2d99282a566b1d0e621783259bab909dce (diff) |
mobile: use VTY bind addr from config, deprecate cmd line options
This change revives the main idea of:
Change-Id: I32517567847fd5c54b1742f18bf409ff81e316fa
to stop ignoring the VTY bind address from the config file.
Furthermore, it deprecates (and disables) both 'u' and 'v'
command line options, because they are redundant.
Change-Id: I99e0ec1717edd29b3be231be86616cc7effe5d95
Diffstat (limited to 'src/host')
-rw-r--r-- | src/host/layer23/include/osmocom/bb/mobile/app_mobile.h | 2 | ||||
-rw-r--r-- | src/host/layer23/src/mobile/app_mobile.c | 9 | ||||
-rw-r--r-- | src/host/layer23/src/mobile/main.c | 28 |
3 files changed, 19 insertions, 20 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/app_mobile.h b/src/host/layer23/include/osmocom/bb/mobile/app_mobile.h index c2ab3c88..191f4baf 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/app_mobile.h +++ b/src/host/layer23/include/osmocom/bb/mobile/app_mobile.h @@ -9,7 +9,7 @@ struct osmocom_ms; struct vty; int l23_app_init(int (*mncc_recv)(struct osmocom_ms *ms, int, void *), - const char *config_file, const char *vty_ip, uint16_t vty_port); + const char *config_file); int l23_app_exit(void); int l23_app_work(int *quit); int mobile_delete(struct osmocom_ms *ms, int force); diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index 464cd55d..a051fbaa 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -39,6 +39,8 @@ #include <osmocom/bb/mobile/voice.h> #include <osmocom/bb/mobile/primitives.h> #include <osmocom/bb/common/sap_interface.h> + +#include <osmocom/vty/ports.h> #include <osmocom/vty/logging.h> #include <osmocom/vty/telnet_interface.h> @@ -434,7 +436,7 @@ static struct vty_app_info vty_info = { /* global init */ int l23_app_init(int (*mncc_recv)(struct osmocom_ms *ms, int, void *), - const char *config_file, const char *vty_ip, uint16_t vty_port) + const char *config_file) { struct telnet_connection dummy_conn; int rc = 0; @@ -462,10 +464,11 @@ int l23_app_init(int (*mncc_recv)(struct osmocom_ms *ms, int, void *), LOGP(DMOB, LOGL_INFO, "Using configuration from '%s'\n", config_file); } vty_reading = 0; - rc = telnet_init_dynif(l23_ctx, NULL, vty_ip, vty_port); + rc = telnet_init_dynif(l23_ctx, NULL, + vty_get_bind_addr(), OSMO_VTY_PORT_BB); if (rc < 0) { LOGP(DMOB, LOGL_FATAL, "Cannot init VTY on %s port %u: %s\n", - vty_ip, vty_port, strerror(errno)); + vty_get_bind_addr(), OSMO_VTY_PORT_BB, strerror(errno)); return rc; } diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c index e015c301..9764b333 100644 --- a/src/host/layer23/src/mobile/main.c +++ b/src/host/layer23/src/mobile/main.c @@ -51,8 +51,6 @@ struct llist_head ms_list; static char *gsmtap_ip = 0; static const char *custom_cfg_file = NULL; struct gsmtap_inst *gsmtap_inst = NULL; -static char *vty_ip = "127.0.0.1"; -unsigned short vty_port = 4247; char *config_dir = NULL; int use_mncc_sock = 0; int daemonize = 0; @@ -87,10 +85,6 @@ static void print_help() printf(" Some help...\n"); printf(" -h --help this text\n"); printf(" -i --gsmtap-ip The destination IP used for GSMTAP.\n"); - printf(" -u --vty-ip The VTY IP to telnet to. " - "(default %s)\n", vty_ip); - printf(" -v --vty-port The VTY port number to telnet to. " - "(default %u)\n", vty_port); printf(" -d --debug Change debug flags. default: %s\n", debug_default); printf(" -D --daemonize Run as daemon\n"); @@ -106,12 +100,13 @@ static int handle_options(int argc, char **argv) static struct option long_options[] = { {"help", 0, 0, 'h'}, {"gsmtap-ip", 1, 0, 'i'}, - {"vty-ip", 1, 0, 'u'}, - {"vty-port", 1, 0, 'v'}, {"debug", 1, 0, 'd'}, {"daemonize", 0, 0, 'D'}, {"config-file", 1, 0, 'c'}, {"mncc-sock", 0, 0, 'm'}, + /* DEPRECATED options, to be removed */ + {"vty-ip", 1, 0, 'u'}, + {"vty-port", 1, 0, 'v'}, {0, 0, 0, 0}, }; @@ -129,15 +124,9 @@ static int handle_options(int argc, char **argv) case 'i': gsmtap_ip = optarg; break; - case 'u': - vty_ip = optarg; - break; case 'c': custom_cfg_file = optarg; break; - case 'v': - vty_port = atoi(optarg); - break; case 'd': log_parse_category_mask(osmo_stderr_target, optarg); break; @@ -147,6 +136,13 @@ static int handle_options(int argc, char **argv) case 'm': use_mncc_sock = 1; break; + /* DEPRECATED options, to be removed */ + case 'u': + case 'v': + fprintf(stderr, "Both 'u' and 'v' options are " + "deprecated! Please use the configuration file " + "in order to set VTY bind address.\n"); + /* fall-thru */ default: /* Unknown parameter passed */ return -EINVAL; @@ -255,9 +251,9 @@ int main(int argc, char **argv) config_dir = dirname(config_dir); if (use_mncc_sock) - rc = l23_app_init(mncc_recv_socket, config_file, vty_ip, vty_port); + rc = l23_app_init(mncc_recv_socket, config_file); else - rc = l23_app_init(NULL, config_file, vty_ip, vty_port); + rc = l23_app_init(NULL, config_file); if (rc) exit(rc); |