laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-hlr/+/16336 )

Change subject: gsup_server: send routing error back to the correct peer
......................................................................

gsup_server: send routing error back to the correct peer

If a peer attempts to add a route to an ipa-name that we already have in the
routing system, don't send the routing error to the peer that already has the
name, but to the peer that attempts to re-use it and would cause the collision.

This is fixing a situation where for example a locally attached MSC has name
'MSC-1', and a remote site is proxying GSUP here for a remote MSC that also has
the name 'MSC-1'. Send the routing error back to the proxy, not local 'MSC-1'.

Change-Id: Icafaedc11b5925149d338bdcb987ae985a7323d6
---
M src/gsup_server.c
1 file changed, 14 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/gsup_server.c b/src/gsup_server.c
index 15d2f83..a5d496e 100644
--- a/src/gsup_server.c
+++ b/src/gsup_server.c
@@ -65,19 +65,30 @@
 static void gsup_server_send_req_response(struct osmo_gsup_req *req, struct 
osmo_gsup_message *response)
 {
        struct osmo_gsup_server *server = req->cb_data;
+       struct osmo_cni_peer_id *routing;
        struct osmo_gsup_conn *conn = NULL;
        struct msgb *msg = osmo_gsup_msgb_alloc("GSUP Tx");
        int rc;

-       switch (req->source_name.type) {
+       if (response->message_type == OSMO_GSUP_MSGT_ROUTING_ERROR
+           && !osmo_cni_peer_id_is_empty(&req->via_proxy)) {
+               /* If a routing error occured, we need to route back via the 
immediate sending peer, not via the
+                * intended final recipient -- because one source of routing 
errors is a duplicate name for a recipient.
+                * If we resolve to req->source_name, we may send to a 
completely unrelated recipient. */
+               routing = &req->via_proxy;
+       } else {
+               routing = &req->source_name;
+       }
+       switch (routing->type) {
        case OSMO_CNI_PEER_ID_IPA_NAME:
-               conn = gsup_route_find_by_ipa_name(server, 
&req->source_name.ipa_name);
+               conn = gsup_route_find_by_ipa_name(server, &routing->ipa_name);
                break;
        default:
                LOG_GSUP_REQ(req, LOGL_ERROR, "GSUP peer id kind not supported: 
%s\n",
-                            osmo_cni_peer_id_type_name(req->source_name.type));
+                            osmo_cni_peer_id_type_name(routing->type));
                break;
        }
+
        if (!conn) {
                LOG_GSUP_REQ(req, LOGL_ERROR, "GSUP client that sent this 
request not found, cannot respond\n");
                msgb_free(msg);

--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/16336
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: Icafaedc11b5925149d338bdcb987ae985a7323d6
Gerrit-Change-Number: 16336
Gerrit-PatchSet: 17
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to