Change in osmocom-bb[master]: mobile: use VTY bind addr from config, deprecate cmd line options

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed Nov 21 03:44:14 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/11852


Change subject: mobile: use VTY bind addr from config, deprecate cmd line options
......................................................................

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
---
M src/host/layer23/include/osmocom/bb/mobile/app_mobile.h
M src/host/layer23/src/mobile/app_mobile.c
M src/host/layer23/src/mobile/main.c
3 files changed, 19 insertions(+), 20 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/52/11852/1

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 c2ab3c8..191f4ba 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 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 464cd55..a051fba 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 @@
 
 /* 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 @@
 		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 e015c30..9764b33 100644
--- a/src/host/layer23/src/mobile/main.c
+++ b/src/host/layer23/src/mobile/main.c
@@ -51,8 +51,6 @@
 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 @@
 	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 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 @@
 		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 @@
 		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 @@
 	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);
 

-- 
To view, visit https://gerrit.osmocom.org/11852
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99e0ec1717edd29b3be231be86616cc7effe5d95
Gerrit-Change-Number: 11852
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181121/cfabe4fd/attachment.htm>


More information about the gerrit-log mailing list