From 6090b1db4b88367df209e8bcbb441cdd2e6a1f68 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sun, 11 Oct 2020 18:41:37 +0200 Subject: 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 --- src/gb/gprs_ns2_udp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3