Change in libosmocore[master]: WIP: gprs_ns2_vty2: improve ip-sns implementation

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

lynxis lazus gerrit-no-reply at lists.osmocom.org
Mon Dec 7 06:41:59 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21576 )


Change subject: WIP: gprs_ns2_vty2: improve ip-sns implementation
......................................................................

WIP: gprs_ns2_vty2: improve ip-sns implementation

Change-Id: I741f21c36f1074e99304d51d96e1c00be24cf3c6
---
M src/gb/gprs_ns2_vty2.c
1 file changed, 26 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/21576/1

diff --git a/src/gb/gprs_ns2_vty2.c b/src/gb/gprs_ns2_vty2.c
index 5604183..fa6a7c4 100644
--- a/src/gb/gprs_ns2_vty2.c
+++ b/src/gb/gprs_ns2_vty2.c
@@ -1007,6 +1007,7 @@
 	struct gprs_ns2_nse *nse = vty->index;
 	bool dialect_modified = false;
 	bool ll_modified = false;
+	int rc;
 
 	const char *bindgroup = argv[0];
 	struct osmo_sockaddr_str remote_str;
@@ -1043,9 +1044,17 @@
 		goto err;
 	}
 
-	/* TODO add */
-
-	return CMD_SUCCESS;
+	rc = gprs_ns2_sns_add_endpoint(nse, &remote);
+	switch (rc) {
+	case 0:
+		return CMD_SUCCESS;
+	case -EADDRINUSE:
+		vty_out(vty, "Specified SNS endpoint already part of the NSE.%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	default:
+		vty_out(vty, "Can not add specified SNS endpoint.%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
 
 err:
 	if (ll_modified)
@@ -1070,6 +1079,7 @@
 	struct osmo_sockaddr_str remote_str; /* argv[2] */
 	struct osmo_sockaddr remote;
 	uint16_t port = atoi(argv[3]);
+	int rc;
 
 	if (nse->ll != GPRS_NS2_LL_UDP) {
 		vty_out(vty, "This NSE doesn't support UDP.%s", VTY_NEWLINE);
@@ -1098,6 +1108,19 @@
 		return CMD_WARNING;
 	}
 
+	rc = gprs_ns2_sns_del_endpoint(nse, &remote);
+	if (rc) {
+		vty_out(vty, "Can not remove specified SNS endpoint.%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	/* TODO:
+	 * - check if sns has endpoints
+	 * - if !empty -> CMD SUCCESS
+	 * - remove sns fsm
+	 * - set to LL/DIALECT to undef
+	 */
+
 	if (llist_empty(&nse->nsvc)) {
 		nse->ll = GPRS_NS2_LL_UNDEF;
 		nse->dialect = NS2_DIALECT_UNDEF;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I741f21c36f1074e99304d51d96e1c00be24cf3c6
Gerrit-Change-Number: 21576
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201207/999a73f8/attachment.htm>


More information about the gerrit-log mailing list