Change in libosmocore[master]: ns2: vty: allow the users (pcu/sgsn) to set a default bind

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
Thu Oct 1 17:16:24 UTC 2020


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


Change subject: ns2: vty: allow the users (pcu/sgsn) to set a default bind
......................................................................

ns2: vty: allow the users (pcu/sgsn) to set a default bind

The SGSN will always bind to 0.0.0.0 in difference the PCU bind is depending
on the info indication. Allow to the user to define a default bind
address.

Change-Id: I2a9dcd14f4ad16211c0f6d98812ad4a13e910c2a
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2_vty.c
2 files changed, 12 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/88/20388/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 6b88c72..8048176 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -9,6 +9,7 @@
 #include <osmocom/core/prim.h>
 
 struct osmo_sockaddr;
+struct osmo_sockaddr_str;
 
 struct gprs_ns2_inst;
 struct gprs_ns2_nse;
@@ -151,7 +152,7 @@
 char *gprs_ns2_ll_str_c(const void *ctx, struct gprs_ns2_vc *nsvc);
 
 /* vty */
-int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi);
+int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi, struct osmo_sockaddr_str *default_bind);
 int gprs_ns2_vty_create();
 void gprs_ns2_vty_force_vc_mode(bool force, enum gprs_ns2_vc_mode mode, const char *reason);
 
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index d274cbe..858297d 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -691,7 +691,14 @@
 	return CMD_SUCCESS;
 }
 
-int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi)
+/**
+ * gprs_ns2_vty_init initialize the bind
+ * \param[inout] nsi
+ * \param[in] bind_default
+ * \param[in] default_bind if not NULL, use it as default value for the bind.
+ * \return 0 on success
+ */
+int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi, struct osmo_sockaddr_str *default_bind)
 {
 	static bool vty_elements_installed = false;
 
@@ -699,6 +706,8 @@
 	memset(&priv, 0, sizeof(struct ns2_vty_priv));
 	INIT_LLIST_HEAD(&priv.vtyvc);
 	priv.vc_mode = NS2_VC_MODE_BLOCKRESET;
+	if (default_bind)
+		memcpy(&priv.udp, default_bind, sizeof(*default_bind));
 
 	/* Regression test code may call this function repeatedly, so make sure
 	 * that VTY elements are not duplicated, which would assert. */

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2a9dcd14f4ad16211c0f6d98812ad4a13e910c2a
Gerrit-Change-Number: 20388
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/20201001/f1bbf1fb/attachment.htm>


More information about the gerrit-log mailing list