[PATCH 4/5] gbproxy: Add a command to delete peers from the GBProxy

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
Wed Oct 23 09:24:17 UTC 2013


From: Holger Hans Peter Freyther <holger at moiji-mobile.com>

This just deletes the peer entry based on NSEI and BVCI. The NS-VC
are not touched.
---
 openbsc/include/openbsc/gb_proxy.h |    1 +
 openbsc/src/gprs/gb_proxy.c        |   26 +++++++++++++++++++++++++-
 openbsc/src/gprs/gb_proxy_vty.c    |    2 ++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/openbsc/include/openbsc/gb_proxy.h b/openbsc/include/openbsc/gb_proxy.h
index 7b14a09..e51dd47 100644
--- a/openbsc/include/openbsc/gb_proxy.h
+++ b/openbsc/include/openbsc/gb_proxy.h
@@ -17,6 +17,7 @@ struct gbproxy_config {
 
 extern struct gbproxy_config gbcfg;
 extern struct cmd_element show_gbproxy_cmd;
+extern struct cmd_element delete_gb_cmd;
 
 /* gb_proxy_vty .c */
 
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index d5872a9..a7640f0 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -1,7 +1,8 @@
 /* NS-over-IP proxy */
 
 /* (C) 2010 by Harald Welte <laforge at gnumonks.org>
- * (C) 2010 by On-Waves
+ * (C) 2010-2013 by On-Waves
+ * (C) 2013 by Holger Hans Peter Freyther
  * All Rights Reserved
  *
  * This program is free software; you can redistribute it and/or modify
@@ -909,3 +910,26 @@ gDEFUN(show_gbproxy, show_gbproxy_cmd, "show gbproxy [stats]",
 	}
 	return CMD_SUCCESS;
 }
+
+gDEFUN(delete_gb, delete_gb_cmd,
+	"delete-gbproxy-peer <0-65534> bvci <0-65534>",
+	"Delete a GBProxy peer by NSEI and BVCI\n"
+	"NSEI number\n"
+	"BVCI\n"
+	"BVCI number\n")
+{
+	struct gbprox_peer *peer, *tmp;
+	const uint16_t nsei = atoi(argv[0]);
+	const uint16_t bvci = atoi(argv[1]);
+
+	llist_for_each_entry_safe(peer, tmp, &gbprox_bts_peers, list) {
+		if (peer->bvci != bvci)
+			continue;
+		if (peer->nsei != nsei)
+			continue;
+
+		peer_free(peer);
+	}
+
+	return CMD_SUCCESS;
+}
diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c
index 63546d3..176ea65 100644
--- a/openbsc/src/gprs/gb_proxy_vty.c
+++ b/openbsc/src/gprs/gb_proxy_vty.c
@@ -80,6 +80,8 @@ int gbproxy_vty_init(void)
 {
 	install_element_ve(&show_gbproxy_cmd);
 
+	install_element(ENABLE_NODE, &delete_gb_cmd);
+
 	install_element(CONFIG_NODE, &cfg_gbproxy_cmd);
 	install_node(&gbproxy_node, config_write_gbproxy);
 	bsc_install_default(GBPROXY_NODE);
-- 
1.7.9.5





More information about the OpenBSC mailing list