Change in libosmo-abis[master]: ipaccess_recvmsg: Untangle code updating line

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/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Jul 14 19:52:39 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/19262 )


Change subject: ipaccess_recvmsg: Untangle code updating line
......................................................................

ipaccess_recvmsg: Untangle code updating line

This patch untangles the code a bit by changing the order where actions
are taken and variables are assigned.

The only real changes in behavour are the introduced assert, and that
bfd->data is set to NULL before releasing the related line.

Related: OS#4624
Change-Id: I947f64f8fa20f87fdc84538402623a6bcf35fdf9
---
M src/input/ipaccess.c
1 file changed, 13 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/62/19262/1

diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 02a5028..d81191c 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -288,37 +288,42 @@
 					"closing socket.\n");
 				goto err;
 			}
+			/* Finally, we know which OML link is associated with
+			 * this RSL link, attach it to this socket. */
+			new_line = sign_link->ts->line;
 			/* this is a bugtrap, the BSC should be using the
 			 * virtual E1 line used by OML for this RSL link. */
-			if (sign_link->ts->line == line) {
+			if (new_line == line) {
 				LOGP(DLINP, LOGL_ERROR,
 					"Fix your BSC, you should use the "
 					"E1 line used by the OML link for "
 					"your RSL link.\n");
 				return 0;
 			}
-			/* Finally, we know which OML link is associated with
-			 * this RSL link, attach it to this socket. */
-			bfd->data = new_line = sign_link->ts->line;
 			e1inp_line_get2(new_line, "ipa_bfd");
 			ts = e1inp_line_ipa_rsl_ts(new_line, unit_data.trx_id);
 			newbfd = &ts->driver.ipaccess.fd;
 			OSMO_ASSERT(newbfd != bfd);
 
-			/* get rid of our old temporary bfd */
 			/* preserve 'newbfd->when' flags potentially set by sign_link_up() */
 			osmo_fd_setup(newbfd, bfd->fd, newbfd->when | bfd->when, bfd->cb,
-				      bfd->data, E1INP_SIGN_RSL + unit_data.trx_id);
+				      new_line, E1INP_SIGN_RSL + unit_data.trx_id);
+
+
+			/* now we can release the dummy RSL line (old temporary bfd). */
 			osmo_fd_unregister(bfd);
 			bfd->fd = -1;
+			/* bfd->data holds a reference to line, drop it */
+			OSMO_ASSERT(bfd->data == line);
+			bfd->data = NULL;
+			e1inp_line_put2(line, "ipa_bfd");
+
 			ret = osmo_fd_register(newbfd);
 			if (ret < 0) {
 				LOGP(DLINP, LOGL_ERROR,
 				     "could not register FD\n");
 				goto err;
 			}
-			/* now we can release the dummy RSL line. */
-			e1inp_line_put2(line, "ipa_bfd");
 
 			e1i_ts = ipaccess_line_ts(newbfd, new_line);
 			ipaccess_bsc_keepalive_fsm_alloc(e1i_ts, newbfd, "rsl_bsc_to_bts");

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

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I947f64f8fa20f87fdc84538402623a6bcf35fdf9
Gerrit-Change-Number: 19262
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200714/89976668/attachment.htm>


More information about the gerrit-log mailing list