summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-10-23 18:39:51 +0200
committerlaforge <laforge@osmocom.org>2019-10-23 18:10:10 +0000
commitf0a0a4cdd78e97dc1462dbb2117c4681e471ebde (patch)
tree1b271e89ed6d16eabe5b898da05175d308f0c6a3
parent6168660986a1bb374c6d0d690db47cb85cd7172b (diff)
ss7: Fix finding asp by socket addr if it has no remote hosts configured
Fixes: 80b135581909fef595d48436ab04dbcb147e3895 Change-Id: I14a0132a4667cea75fc212dfeeef76d8509b991d
-rw-r--r--src/osmo_ss7.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 8a86af1..88c4922 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1174,12 +1174,15 @@ osmo_ss7_asp_find_by_socket_addr(int fd)
if (i == asp->cfg.local.host_cnt)
continue; /* didn't match any local.host */
- for (i = 0; i < asp->cfg.remote.host_cnt; i++) {
- if (!asp->cfg.remote.host[i] || !strcmp(asp->cfg.remote.host[i], hostbuf_r))
- break;
+ /* If no remote host was set, it's probably a server and hence we match any cli src */
+ if (asp->cfg.remote.host_cnt) {
+ for (i = 0; i < asp->cfg.remote.host_cnt; i++) {
+ if (!asp->cfg.remote.host[i] || !strcmp(asp->cfg.remote.host[i], hostbuf_r))
+ break;
+ }
+ if (i == asp->cfg.remote.host_cnt)
+ continue; /* didn't match any remote.host */
}
- if (i == asp->cfg.remote.host_cnt)
- continue; /* didn't match any remote.host */
return asp;
}