Change in osmo-bts[master]: abis: Fix line leaked & recreated upon every reconnect

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
Thu Sep 30 11:12:43 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/25640 )

Change subject: abis: Fix line leaked & recreated upon every reconnect
......................................................................

abis: Fix line leaked & recreated upon every reconnect

Previous code creating a new line was really a workaround to have it
working while previous lines were being stacked internally inside
libosmo-abis.
Let's handle reference counts for the line properly and keep using the
same line always (since it can be further configured by libosmo-abis' VTY).
Recent patches to libosmo-abis fixed a bug where e1inp_line_update()
would only work the first time it was called on a e1np_line, and follow
up calls would be no-ops. This fix allows re-configuring and hence
reusing the same line to reconnect to BSC.

Depends: libosmo-abis Change-Id: Iff8092f88726cf238dac2abb99e135ac5864272d
Change-Id: Id7fd3ef81bbc517821def31f1a60f905a0e2fb52
---
M src/common/abis.c
1 file changed, 5 insertions(+), 12 deletions(-)

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



diff --git a/src/common/abis.c b/src/common/abis.c
index 93635c2..11111fa 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -81,7 +81,6 @@
 	struct bsc_oml_host *current_bsc;
 	struct gsm_bts *bts;
 	char *model_name;
-	int line_ctr;
 };
 
 static void reset_oml_link(struct gsm_bts *bts)
@@ -156,22 +155,16 @@
 		bts_dev_info.unit_name = bts->description;
 	bts_dev_info.location2 = priv->model_name;
 
-	line = e1inp_line_find(priv->line_ctr);
-	if (line) {
-		e1inp_line_get2(line, __FILE__);	/* We want a new reference for returned line */
-	} else
-		line = e1inp_line_create(priv->line_ctr, "ipa");	/* already comes with a reference */
-
-	/* The abis connection may fail and we may have to try again with a different BSC (if configured). The next
-	 * attempt must happen on a different line. */
-	priv->line_ctr++;
-
+	line = e1inp_line_find(0);
+	if (!line)
+		line = e1inp_line_create(0, "ipa");
 	if (!line) {
 		osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0);
 		return;
 	}
-	e1inp_line_bind_ops(line, &line_ops);
+	/* Line always comes already with a "ctor" reference, enough to keep it alive forever. */
 
+	e1inp_line_bind_ops(line, &line_ops);
 	/* This will open the OML connection now */
 	if (e1inp_line_update(line) < 0) {
 		osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id7fd3ef81bbc517821def31f1a60f905a0e2fb52
Gerrit-Change-Number: 25640
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy 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/20210930/0b7a2a6e/attachment.htm>


More information about the gerrit-log mailing list