This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/19852 ) Change subject: Fix matching IPv6 anyaddr :: in osmo_ss7_asp_find_by_socket_addr ...................................................................... Fix matching IPv6 anyaddr :: in osmo_ss7_asp_find_by_socket_addr Change-Id: I36dd8f1978e3b7b785660745378c9cf77a21a566 --- M src/osmo_ss7.c 1 file changed, 19 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index b58de34..7639c41 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1241,6 +1241,7 @@ socklen_t sa_len_r = sizeof(sa_r); char hostbuf_l[64], hostbuf_r[64]; uint16_t local_port, remote_port; + bool loc_is_v6, rem_is_v6; int rc; int i; @@ -1272,6 +1273,8 @@ */ chop_v4_mapped_on_v6_prefix(hostbuf_l); chop_v4_mapped_on_v6_prefix(hostbuf_r); + loc_is_v6 = osmo_ip_str_type(hostbuf_l) == AF_INET6; + rem_is_v6 = osmo_ip_str_type(hostbuf_r) == AF_INET6; /* check all instances for any ASP definition matching the * address combination of local/remote ip/port */ @@ -1284,8 +1287,14 @@ continue; for (i = 0; i < asp->cfg.local.host_cnt; i++) { - bool is_any = !asp->cfg.local.host[i] || !strcmp(asp->cfg.local.host[i], "0.0.0.0"); - if (is_any || !strcmp(asp->cfg.local.host[i], hostbuf_l)) + bool iter_is_v6 = osmo_ip_str_type(asp->cfg.local.host[i]) == AF_INET6; + bool iter_is_anyaddr = host_is_ip_anyaddr(asp->cfg.local.host[i], iter_is_v6); + /* "::" (v6) covers "0.0.0.0" (v4), but not otherwise */ + if (iter_is_v6 != loc_is_v6 && + !(iter_is_v6 && iter_is_anyaddr)) + continue; + if (iter_is_anyaddr || + !strcmp(asp->cfg.local.host[i], hostbuf_l)) break; } if (i == asp->cfg.local.host_cnt) @@ -1294,7 +1303,14 @@ /* 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)) + bool iter_is_v6 = osmo_ip_str_type(asp->cfg.remote.host[i]) == AF_INET6; + bool iter_is_anyaddr = host_is_ip_anyaddr(asp->cfg.remote.host[i], iter_is_v6); + /* "::" (v6) covers "0.0.0.0" (v4), but not otherwise */ + if (iter_is_v6 != rem_is_v6 && + !(iter_is_v6 && iter_is_anyaddr)) + continue; + if (iter_is_anyaddr || + !strcmp(asp->cfg.remote.host[i], hostbuf_r)) break; } if (i == asp->cfg.remote.host_cnt) -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/19852 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I36dd8f1978e3b7b785660745378c9cf77a21a566 Gerrit-Change-Number: 19852 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200829/52eeabcf/attachment.htm>