Change in libosmo-abis[master]: Include vty command 'pcap' in vty 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/.

keith gerrit-no-reply at lists.osmocom.org
Thu Nov 12 06:00:35 UTC 2020


keith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/21118 )


Change subject: Include vty command 'pcap' in vty output
......................................................................

Include vty command 'pcap' in vty output

Ensure that a configured pcap command appears in 'show running-config'
and is written to the config file on issuing 'write'

Change-Id: I316c3d6a839e84c2f52a148c6b8dd6f5933cf4bf
---
M include/osmocom/abis/e1_input.h
M src/e1_input_vty.c
2 files changed, 24 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/18/21118/1

diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 44708bb..795c83a 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -194,6 +194,7 @@
 	struct llist_head list;
 	int refcnt; /* unusued, kept for ABI compat, use_count is used instead */
 
+	char *pcap_file;
 	unsigned int num;
 	const char *name;
 	unsigned int port_nr;
diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index d915c19..cc4bc17 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -250,7 +250,15 @@
 	   "Setup a pcap recording of all E1 traffic\n"
 	   "Filename to save the packets to\n", CMD_ATTR_IMMEDIATE)
 {
+	struct e1inp_line *line;
 	int fd;
+	int e1_nr = 0;
+
+	line = e1inp_line_find(e1_nr);
+	if (!line) {
+		vty_out(vty, "%% Line %d doesn't exist%s", e1_nr, VTY_NEWLINE);
+		return CMD_WARNING;
+	}
 
 	fd = open(argv[0], O_WRONLY | O_CREAT | O_TRUNC, 0660);
 	if (fd < 0) {
@@ -259,6 +267,11 @@
 	}
 
 	e1_set_pcap_fd(fd);
+	if (line->pcap_file) {
+		talloc_free((void *)line->pcap_file);
+		line->pcap_file = NULL;
+	}
+	line->pcap_file = talloc_strdup(line, argv[0]);
 
 	return CMD_SUCCESS;
 }
@@ -268,7 +281,15 @@
 	   NO_STR "Disable pcap recording of all E1 traffic\n",
 	   CMD_ATTR_IMMEDIATE)
 {
+	struct e1inp_line *line;
+	int e1_nr = 0;
+	line = e1inp_line_find(e1_nr);
+
 	e1_set_pcap_fd(-1);
+	if (line->pcap_file) {
+		talloc_free((void *)line->pcap_file);
+		line->pcap_file = NULL;
+	}
 	return CMD_SUCCESS;
 }
 
@@ -329,6 +350,8 @@
 			vty_out(vty, " e1_line %u ipa-keepalive %d %d%s", line->num,
 				line->ipa_kap->interval, line->ipa_kap->wait_for_resp,
 				VTY_NEWLINE);
+		if (line->pcap_file)
+			vty_out(vty, " pcap %s%s", line->pcap_file, VTY_NEWLINE);
 	}
 
 	const char *ipa_bind = e1inp_ipa_get_bind_addr();

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

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I316c3d6a839e84c2f52a148c6b8dd6f5933cf4bf
Gerrit-Change-Number: 21118
Gerrit-PatchSet: 1
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201112/3e24a674/attachment.htm>


More information about the gerrit-log mailing list