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
This commit is contained in:
Stefan Sperling 2018-03-22 20:19:56 +01:00
parent d3b8b69977
commit 49917c129b
1 changed files with 5 additions and 1 deletions

View File

@ -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;