aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns2_vty.c
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-10-01 19:08:38 +0200
committerlaforge <laforge@osmocom.org>2020-10-05 14:23:33 +0000
commit1fac6f7452d2aa6cb28b6af9858646c0badf60e4 (patch)
treea1472a815539711fed75eda5bd6657c1017ac003 /src/gb/gprs_ns2_vty.c
parent024e1957cc4c39bb30144e2c023151e35df473e1 (diff)
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
Diffstat (limited to 'src/gb/gprs_ns2_vty.c')
-rw-r--r--src/gb/gprs_ns2_vty.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 321b23f2..824466ba 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -690,7 +690,13 @@ DEFUN(logging_fltr_nsvc,
return CMD_SUCCESS;
}
-int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi)
+/**
+ * gprs_ns2_vty_init initialize the vty
+ * \param[inout] nsi
+ * \param[in] default_bind set the default address to bind to. Can be NULL.
+ * \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;
@@ -698,6 +704,8 @@ int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi)
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. */