diff mbox

osmo-pcap[master]: Use TCP port numbers for VTY that don't overlap with other O...

Message ID gerrit.1500631635214.I638ac0534517931d0987ce9f72f5db4f5b6c16b7@gerrit.osmocom.org
State New
Headers show

Commit Message

gerrit-no-reply@lists.osmocom.org July 21, 2017, 10:07 a.m. UTC
Review at  https://gerrit.osmocom.org/3323

Use TCP port numbers for VTY that don't overlap with other Osmocom Software

osmo-pcap historically was using port numbers that ware already used by
OsmoPCU and OsmoBTS.  This leads to problems when wanting to run related
software together on one system.  Let's break the historical assumptions
and start with non-overlapping port numbers that are allocated/assigned
from https://osmocom.org/projects/cellular-infrastructure/wiki/Port_Numbers

Change-Id: I638ac0534517931d0987ce9f72f5db4f5b6c16b7
---
M include/osmo-pcap/common.h
M osmoappdesc.py
M src/osmo_client_main.c
M src/osmo_server_main.c
4 files changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/23/3323/1

Comments

gerrit-no-reply@lists.osmocom.org July 21, 2017, 11:53 a.m. UTC | #1
Patch Set 2: Code-Review+2

Strictly speaking osmo-pcap was first and OsmoPCU and OsmoBTS used them besides they were already being used. ;)

Anyway, I don't know any big consumers of the pcap-client VTY
gerrit-no-reply@lists.osmocom.org July 21, 2017, 1:23 p.m. UTC | #2
Patch Set 3: Code-Review+2

(1 comment)

https://gerrit.osmocom.org/#/c/3323/3//COMMIT_MSG
Commit Message:

Line 9: osmo-pcap for historical reasons uses the same port numbers as
That was not necessary but thank you.
diff mbox

Patch

diff --git a/include/osmo-pcap/common.h b/include/osmo-pcap/common.h
index 13c76e1..27fd514 100644
--- a/include/osmo-pcap/common.h
+++ b/include/osmo-pcap/common.h
@@ -28,6 +28,15 @@ 
 #include <osmocom/vty/vty.h>
 #include <osmocom/vty/buffer.h>
 #include <osmocom/vty/command.h>
+#include <osmocom/vty/ports.h>
+
+/* support old versions of libosmocore */
+#ifndef OSMO_VTY_PORT_PCAP_CLIENT
+#define OSMO_VTY_PORT_PCAP_CLIENT	4237
+#endif
+#ifndef OSMO_VTY_PORT_PCAP_SERVER
+#define OSMO_VTY_PORT_PCAP_SERVER	4238
+#endif
 
 enum {
 	DPCAP,
diff --git a/osmoappdesc.py b/osmoappdesc.py
index 39928eb..6f66702 100644
--- a/osmoappdesc.py
+++ b/osmoappdesc.py
@@ -20,8 +20,8 @@ 
 }
 
 apps = [
-    (4241, "src/osmo_pcap_server", "OsmoPCAPServer", "osmo-pcap-server"),
-    (4240, "src/osmo_pcap_client", "OsmoPCAPClient", "osmo-pcap-client"),
+    (4238, "src/osmo_pcap_server", "OsmoPCAPServer", "osmo-pcap-server"),
+    (4237, "src/osmo_pcap_client", "OsmoPCAPClient", "osmo-pcap-client"),
         ]
 
 vty_command = ["src/osmo_pcap_server", "-c", "contrib/osmo-pcap-server.cfg"]
diff --git a/src/osmo_client_main.c b/src/osmo_client_main.c
index 89d7e04..46a49b5 100644
--- a/src/osmo_client_main.c
+++ b/src/osmo_client_main.c
@@ -206,7 +206,7 @@ 
 
 	osmo_tls_init();
 
-	rc = telnet_init(tall_bsc_ctx, NULL, 4240);
+	rc = telnet_init(tall_bsc_ctx, NULL, OSMO_VTY_PORT_PCAP_CLIENT);
 	if (rc < 0) {
 		LOGP(DCLIENT, LOGL_ERROR, "Failed to bind telnet interface\n");
 		exit(1);
diff --git a/src/osmo_server_main.c b/src/osmo_server_main.c
index 37a9632..95f3ce1 100644
--- a/src/osmo_server_main.c
+++ b/src/osmo_server_main.c
@@ -219,7 +219,7 @@ 
 
 	osmo_tls_init();
 
-	rc = telnet_init(tall_bsc_ctx, NULL, 4241);
+	rc = telnet_init(tall_bsc_ctx, NULL, OSMO_VTY_PORT_PCAP_SERVER);
 	if (rc < 0) {
 		LOGP(DCLIENT, LOGL_ERROR, "Failed to bind telnet interface\n");
 		exit(1);