Change in libosmo-abis[master]: e1_input: Add VTY command to enable PCAP debug output

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

tnt gerrit-no-reply at lists.osmocom.org
Sat May 9 15:31:29 UTC 2020


tnt has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/18114 )

Change subject: e1_input: Add VTY command to enable PCAP debug output
......................................................................

e1_input: Add VTY command to enable PCAP debug output

This command is also usable at run-time to dynamically
enable / disable e1 tracing on all active lines

Signed-off-by: Sylvain Munaut <tnt at 246tNt.com>
Change-Id: I0b4251702aecd6721b9d63c320351ef6cb513454
---
M src/e1_input_vty.c
1 file changed, 32 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  tnt: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index 8d89d04..15f325f 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -20,9 +20,12 @@
  */
 #include "internal.h"
 
+#include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 #include <sys/un.h>
 
 #include <osmocom/core/linuxlist.h>
@@ -232,6 +235,32 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_e1_pcap, cfg_e1_pcap_cmd,
+	"pcap .FILE",
+	"Setup a pcap recording of all E1 traffic\n"
+	"Filename to save the packets to\n")
+{
+	int fd;
+
+	fd = open(argv[0], O_WRONLY | O_CREAT | O_TRUNC, 0660);
+	if (fd < 0) {
+		vty_out(vty, "Failed to setup E1 pcap recording to %s.%s", argv[0], VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	e1_set_pcap_fd(fd);
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_e1_no_pcap, cfg_e1_no_pcap_cmd,
+	"no pcap",
+	NO_STR "Disable pcap recording of all E1 traffic\n")
+{
+	e1_set_pcap_fd(-1);
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_e1inp, cfg_e1inp_cmd,
 	"e1_input",
 	"Configure E1/T1/J1 TDM input\n")
@@ -436,6 +465,9 @@
 	install_element(CONFIG_NODE, &cfg_e1inp_cmd);
 	install_node(&e1inp_node, e1inp_config_write);
 
+	install_element(L_E1INP_NODE, &cfg_e1_pcap_cmd);
+	install_element(L_E1INP_NODE, &cfg_e1_no_pcap_cmd);
+
 	install_element(L_E1INP_NODE, &cfg_e1_line_driver_cmd);
 	install_element(L_E1INP_NODE, &cfg_e1_line_port_cmd);
 	install_element(L_E1INP_NODE, &cfg_e1_line_socket_cmd);

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

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I0b4251702aecd6721b9d63c320351ef6cb513454
Gerrit-Change-Number: 18114
Gerrit-PatchSet: 6
Gerrit-Owner: tnt <tnt at 246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200509/b4fed60d/attachment.htm>


More information about the gerrit-log mailing list