ipacces: Fix e1inp_line reference put in ipaccess_close
Drop the function e1inp_close_socket since it's only used by the caller
at hand, and it's only exported through "internal.h", so no app is using
it. Remove it because there's only a caller, and furthermore because
keeping it (and putting bfd->data==line) would introduce a layer
violation because the bfd->data==line is only used for ipaccess so far.
Triggering path:
handle_ts1_read ret=0 "Sign link vanished"
ipaccess_drop
line->ops->sign_link_down
(osmo-bsc) ipaccess_drop_oml
e1inp_sign_link_destroy
link->ts->line->driver->close
ipaccess_close
Related: OS#4624
Change-Id: If23cc722106a9f70c998e591369a4acafa52c519
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 08b34a4..4d55e71 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -431,7 +431,19 @@
}
- return e1inp_close_socket(e1i_ts, sign_link, bfd);
+ e1inp_int_snd_event(e1i_ts, sign_link, S_L_INP_TEI_DN);
+ /* the first e1inp_sign_link_destroy call closes the socket. */
+ if (bfd->fd != -1) {
+ osmo_fd_unregister(bfd);
+ close(bfd->fd);
+ bfd->fd = -1;
+ /* If The bfd holds a reference to e1inp_line in ->data (BSC
+ * accepted() sockets), then release it */
+ if (bfd->data == line) {
+ bfd->data = NULL;
+ e1inp_line_put2(line, "ipa_bfd");
+ }
+ }
}
static void timeout_ts1_write(void *data)