[PATCH 1/3] gb/vty: Perform NS-VC operations based on NS-VCI

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/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Tue Oct 22 10:22:39 UTC 2013


This adds a 'nsvc nsvci <0-65535> (block|unblock|reset)' vty
command. It selects the NS-VC based on the nsvci instead of using the
first with a matching NSEI, like it is done when the 'nsei' keyword
is used instead.

Sponsored-by: On-Waves ehf
---
 src/gb/gprs_ns_vty.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/gb/gprs_ns_vty.c b/src/gb/gprs_ns_vty.c
index a2e7beb..f33fd0b 100644
--- a/src/gb/gprs_ns_vty.c
+++ b/src/gb/gprs_ns_vty.c
@@ -499,21 +499,29 @@ DEFUN(cfg_frgre_enable, cfg_frgre_enable_cmd,
 }
 
 DEFUN(nsvc_nsei, nsvc_nsei_cmd,
-	"nsvc nsei <0-65535> (block|unblock|reset)",
+	"nsvc (nsei|nsvci) <0-65535> (block|unblock|reset)",
 	"Perform an operation on a NSVC\n"
 	"NSEI to identify NS-VC Identifier (NS-VCI)\n"
+	"NS-VC Identifier (NS-VCI)\n"
 	"The NSEI\n"
 	"Initiate BLOCK procedure\n"
 	"Initiate UNBLOCK procedure\n"
 	"Initiate RESET procedure\n")
 {
-	uint16_t nsvci = atoi(argv[0]);
-	const char *operation = argv[1];
+	const char *id_type = argv[0];
+	uint16_t id = atoi(argv[1]);
+	const char *operation = argv[2];
 	struct gprs_nsvc *nsvc;
 
-	nsvc = gprs_nsvc_by_nsei(vty_nsi, nsvci);
+	if (!strcmp(id_type, "nsei"))
+		nsvc = gprs_nsvc_by_nsei(vty_nsi, id);
+	else if (!strcmp(id_type, "nsvci"))
+		nsvc = gprs_nsvc_by_nsvci(vty_nsi, id);
+	else
+		return CMD_WARNING;
+
 	if (!nsvc) {
-		vty_out(vty, "No such NSVCI (%u)%s", nsvci, VTY_NEWLINE);
+		vty_out(vty, "No such %s (%u)%s", id_type, id, VTY_NEWLINE);
 		return CMD_WARNING;
 	}
 
-- 
1.7.9.5





More information about the OpenBSC mailing list