Change in ...libosmocore[master]: vty/vty.c: log received commands from telnet interface

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Sat Jul 27 19:35:15 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/14974


Change subject: vty/vty.c: log received commands from telnet interface
......................................................................

vty/vty.c: log received commands from telnet interface

This may be useful for investigating TTCN-3 test case failures.

Change-Id: I5f6639f6ebc3e8f8df50ef48538df94285b759fd
---
M src/vty/vty.c
1 file changed, 14 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/14974/1

diff --git a/src/vty/vty.c b/src/vty/vty.c
index c557524..4960aea 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -61,11 +61,14 @@
 #include <sys/param.h>
 
 #include <arpa/telnet.h>
+#include <arpa/inet.h>
 
 #include <osmocom/vty/vty.h>
 #include <osmocom/vty/command.h>
 #include <osmocom/vty/buffer.h>
 #include <osmocom/core/talloc.h>
+#include <osmocom/core/logging.h>
+#include <osmocom/core/socket.h>
 
 /* \addtogroup vty
  * @{
@@ -422,6 +425,17 @@
 	int ret;
 	vector vline;
 
+	if (vty->length > 0 && log_check_level(DLGLOBAL, LOGL_DEBUG)) {
+		char rem_addr[INET6_ADDRSTRLEN + 1] = "(unknown)";
+		char rem_port[10] = "(unknown)";
+
+		osmo_sock_get_ip_and_port(vty->fd, rem_addr, sizeof(rem_addr),
+						   rem_port, sizeof(rem_port),
+						   false);
+		LOGP(DLGLOBAL, LOGL_DEBUG, "(%s:%s) Got VTY command: '%s'\n",
+		     rem_addr, rem_port, buf);
+	}
+
 	/* Split readline string up into the vector */
 	vline = cmd_make_strvec(buf);
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5f6639f6ebc3e8f8df50ef48538df94285b759fd
Gerrit-Change-Number: 14974
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190727/5e64b3e4/attachment.htm>


More information about the gerrit-log mailing list