Change in libosmocore[master]: gprs_ns2: gprs_ns2_ip_bind() check if the bind already exists

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Oct 12 13:08:43 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20553 )

Change subject: gprs_ns2: gprs_ns2_ip_bind() check if the bind already exists
......................................................................

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
---
M src/gb/gprs_ns2_udp.c
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  daniel: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



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;
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20553
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib816f14c387cc6ff86f9c0057daded1d72cee0f5
Gerrit-Change-Number: 20553
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201012/91c64356/attachment.htm>


More information about the gerrit-log mailing list