aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-11-23 14:54:00 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-11-24 15:40:09 +0100
commit9af069d5daecd586a78f0c411ff3d3919465fb2f (patch)
tree581b6471d510bd6e3041412bd229bb305fad9ee0
parent91314c10af9d034044540a30cba24766d6ee5e7a (diff)
ipaccess: Fix wrong assertion in ipaccess_drop() when used by BTS code
The code wrongly assumed that ipaccess_drop was only called by BSC code, which is wrong. ipaccess_drop is called by BTS run code path in __handle_ts1_write(), if send() syscall fails (for instance because BSC becomes unreachable). In that case, we need to account for the BTS role case which doesn't store the line pointer into the ofd->data. In BTS case, it's a pointer to the struct ipa_client_conn, which we leave up to sign_link_down() cb to do whatever they please with. Fixes: OS#4864 Change-Id: If763e5f7736921a4360ad9027ba075ef8e118934
-rw-r--r--src/input/ipaccess.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 48a427c..a370c77 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -92,13 +92,23 @@ static int ipaccess_drop(struct osmo_fd *bfd, struct e1inp_line *line)
osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
- /* This is BSC code, ipaccess_drop() is only called for
- accepted() sockets, hence the bfd holds a reference to
- e1inp_line in ->data that needs to be released */
- OSMO_ASSERT(bfd->data == line);
- bfd->data = NULL;
- e1inp_line_put2(line, "ipa_bfd");
-
+ switch (line->ops->cfg.ipa.role) {
+ case E1INP_LINE_R_BSC:
+ /* This is BSC code, ipaccess_drop() is only called for
+ accepted() sockets, hence the bfd holds a reference to
+ e1inp_line in ->data that needs to be released */
+ OSMO_ASSERT(bfd->data == line);
+ bfd->data = NULL;
+ e1inp_line_put2(line, "ipa_bfd");
+ break;
+ case E1INP_LINE_R_BTS:
+ /* BTS code: bfd->data contains pointer to struct
+ * ipa_client_conn. Leave it alive so it reconnects.
+ */
+ break;
+ default:
+ break;
+ }
ret = -ENOENT;
} else {
LOGPITS(e1i_ts, DLINP, LOGL_ERROR,