Review at  https://gerrit.osmocom.org/3452

sccp: fix creating of the default route in simple client

The simple client (osmo_sccp_simple_client_on_ss7_id() and
osmo_sccp_simple_client) does not create a default route if
the user has already created an AS via VTY.

Check the presence of a default route independently of the
AS. If no default route exists, create one.

Change-Id: I7516fa5509bade4ba10e9d8eaa3e46cfe3696b3a
---
M src/sccp_user.c
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/52/3452/1

diff --git a/src/sccp_user.c b/src/sccp_user.c
index 1414572..1d59d3c 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -368,16 +368,20 @@
                        goto out_ss7;
                }
                as->cfg.routing_key.pc = ss7->cfg.primary_pc;
+       }
+       LOGP(DLSCCP, LOGL_NOTICE, "%s: Using AS instance %s\n", name,
+            as->cfg.name);
 
-               /* install default route */
+       /* Create a default route if necessary */
+       rt = osmo_ss7_route_find_dpc_mask(ss7->rtable_system, 0, 0);
+       if (!rt) {
+               LOGP(DLSCCP, LOGL_NOTICE, "%s: Creating default route\n", name);
                rt = osmo_ss7_route_create(ss7->rtable_system, 0, 0,
                                           as->cfg.name);
                if (!rt)
                        goto out_as;
                rt_created = true;
        }
-       LOGP(DLSCCP, LOGL_NOTICE, "%s: Using AS instance %s\n", name,
-            as->cfg.name);
 
        /* Check if we do already have an application server process
         * that is associated with the application server we have choosen

-- 
To view, visit https://gerrit.osmocom.org/3452
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7516fa5509bade4ba10e9d8eaa3e46cfe3696b3a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>

Reply via email to