aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns2_frgre.c
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-12-03 06:02:03 +0100
committerlynxis lazus <lynxis@fe80.eu>2020-12-15 11:46:45 +0000
commitaaa55a663eb3a96db043e4bf83c7ad9be36718d1 (patch)
treece179599abd5703b12aba0496e2abd19b47b9d32 /src/gb/gprs_ns2_frgre.c
parent93ad4998322dce1b67391c4bad135308d81cae36 (diff)
gprs_ns2: add member name to bind
Every bind will have a unique name. Add a name argument to all bind creating functions and require them to be unique. This is an API break but there wasn't yet a release with NS2. Change-Id: I8f1d66b7b3b12da12db8b5e6bd08c1beff085b3e
Diffstat (limited to 'src/gb/gprs_ns2_frgre.c')
-rw-r--r--src/gb/gprs_ns2_frgre.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gb/gprs_ns2_frgre.c b/src/gb/gprs_ns2_frgre.c
index 423ea4b7..014517aa 100644
--- a/src/gb/gprs_ns2_frgre.c
+++ b/src/gb/gprs_ns2_frgre.c
@@ -538,6 +538,7 @@ int gprs_ns2_is_frgre_bind(struct gprs_ns2_vc_bind *bind)
* \param[out] result pointer to created bind
* \return 0 on success; negative on error */
int gprs_ns2_frgre_bind(struct gprs_ns2_inst *nsi,
+ const char *name,
const struct osmo_sockaddr *local,
int dscp,
struct gprs_ns2_vc_bind **result)
@@ -546,6 +547,12 @@ int gprs_ns2_frgre_bind(struct gprs_ns2_inst *nsi,
struct priv_bind *priv;
int rc;
+ if (!name)
+ return -ENOSPC;
+
+ if (gprs_ns2_bind_by_name(nsi, name))
+ return -EALREADY;
+
if (!bind)
return -ENOSPC;
@@ -554,6 +561,12 @@ int gprs_ns2_frgre_bind(struct gprs_ns2_inst *nsi,
return -EINVAL;
}
+ bind->name = talloc_strdup(bind, name);
+ if (!bind->name) {
+ talloc_free(bind);
+ return -ENOSPC;
+ }
+
bind->driver = &vc_driver_frgre;
bind->ll = GPRS_NS2_LL_FR_GRE;
bind->send_vc = frgre_vc_sendmsg;