[MERGED] libosmo-abis[master]: preserve 'when' flags of new osmo_fd in ipaccess_rcvmsg()

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

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Mon Mar 26 10:44:10 UTC 2018


Stefan Sperling has submitted this change and it was merged.

Change subject: preserve 'when' flags of new osmo_fd in ipaccess_rcvmsg()
......................................................................


preserve 'when' flags of new osmo_fd in ipaccess_rcvmsg()

ipaccess_rcvmsg() disposes of a temporary osmo_fd structure after
the RSL link comes up. It copies data from its temporary osmo_fd
to the new one returned by sign_link_up(). However, in doing so,
it clobbered the 'when' flags, which could differ between the two
osmo_fd structures.
For instance, BSC_FD_WRITE could be set on the new osmo_fd but
not on the old one, in case sign_link_up() has already enqueued
outbound messages using the new osmo_fd.

Because of this behaviour, a patch committed to osmo-bsc to address
issue #2719 did not work as intended and had to be reverted.
After this change, that osmo-bsc patch should work as intended
and issue #2719 can hopefully be resolved.

Change-Id: I52f7c903212b38e9c87e4d45e52b231b6f1ae9f5
Related: OS#2719
---
M src/input/ipaccess.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Neels Hofmeyr: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 5eee57e..9a80d8e 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -194,7 +194,11 @@
 			newbfd = &ts->driver.ipaccess.fd;
 
 			/* get rid of our old temporary bfd */
-			memcpy(newbfd, bfd, sizeof(*newbfd));
+			memcpy(&newbfd->list, &bfd->list, sizeof(newbfd->list));
+			newbfd->fd = bfd->fd;
+			newbfd->when |= bfd->when; /* preserve 'newbfd->when' flags potentially set by sign_link_up() */
+			newbfd->cb = bfd->cb;
+			newbfd->data = bfd->data;
 			newbfd->priv_nr = E1INP_SIGN_RSL + unit_data.trx_id;
 			osmo_fd_unregister(bfd);
 			bfd->fd = -1;

-- 
To view, visit https://gerrit.osmocom.org/7462
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I52f7c903212b38e9c87e4d45e52b231b6f1ae9f5
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>



More information about the gerrit-log mailing list