diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-03-22 20:19:56 +0100 |
---|---|---|
committer | Stefan Sperling <ssperling@sysmocom.de> | 2018-03-22 20:28:25 +0100 |
commit | 49917c129b1456585258b0ebe89a513ecef823a8 (patch) | |
tree | 5d274ba17f45f58b9668d5f2db29c6d99f3b6db8 /src | |
parent | d3b8b69977207235056f6033e5828796e5620049 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/input/ipaccess.c | 6 |
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; |