aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-10-11 18:41:37 +0200
committerlaforge <laforge@osmocom.org>2020-10-12 13:08:42 +0000
commit6090b1db4b88367df209e8bcbb441cdd2e6a1f68 (patch)
treebdaf393790fc94f8a7607ffa82ba82bf27261902
parent4f60845552024419ecf8ad2c20cf108be7be4e04 (diff)
gprs_ns2: gprs_ns2_ip_bind() check if the bind already exists
To prevent adding the same bind twice. It also returns the bind in **result. Change-Id: Ib816f14c387cc6ff86f9c0057daded1d72cee0f5
-rw-r--r--src/gb/gprs_ns2_udp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index a5781606..7ead71a1 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -302,10 +302,17 @@ int gprs_ns2_ip_bind(struct gprs_ns2_inst *nsi,
int dscp,
struct gprs_ns2_vc_bind **result)
{
- struct gprs_ns2_vc_bind *bind = talloc_zero(nsi, struct gprs_ns2_vc_bind);
+ struct gprs_ns2_vc_bind *bind;
struct priv_bind *priv;
int rc;
+ bind = gprs_ns2_ip_bind_by_sockaddr(nsi, local);
+ if (bind) {
+ *result = bind;
+ return -EBUSY;
+ }
+
+ bind = talloc_zero(nsi, struct gprs_ns2_vc_bind);
if (!bind)
return -ENOSPC;