aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-03-22 20:19:56 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-03-22 20:28:25 +0100
commit49917c129b1456585258b0ebe89a513ecef823a8 (patch)
tree5d274ba17f45f58b9668d5f2db29c6d99f3b6db8
parentjenkins.sh: use --enable-werror configure flag, not CFLAGS (diff)
downloadlibosmo-abis-49917c129b1456585258b0ebe89a513ecef823a8.tar.xz
libosmo-abis-49917c129b1456585258b0ebe89a513ecef823a8.zip
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
-rw-r--r--src/input/ipaccess.c6
1 files changed, 5 insertions, 1 deletions
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 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg,
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;