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
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index a578160..7ead71a 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -302,10 +302,17 @@
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;