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

cosmetic: hmrt_message_for_routing(): use osmo_ss7_route_name()

Change-Id: Iae524c38cd91383a59c64bf7919d94ba7ff350bd
---
M src/osmo_ss7_hmrt.c
1 file changed, 19 insertions(+), 12 deletions(-)


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

diff --git a/src/osmo_ss7_hmrt.c b/src/osmo_ss7_hmrt.c
index a1f9e92..882d85d 100644
--- a/src/osmo_ss7_hmrt.c
+++ b/src/osmo_ss7_hmrt.c
@@ -217,12 +217,15 @@
                /* FIXME: Transmit over respective Link */
                if (rt->dest.as) {
                        struct osmo_ss7_as *as = rt->dest.as;
-                       DEBUGP(DLSS7,
-                              "Found route for dpc=%u=%s: pc=%u=%s mask=0x%x"
-                              " via AS %s proto=%s\n",
-                              dpc, osmo_ss7_pointcode_print(inst, dpc),
-                              rt->cfg.pc, osmo_ss7_pointcode_print2(inst, 
rt->cfg.pc), rt->cfg.mask,
-                              as->cfg.name, 
osmo_ss7_asp_protocol_name(as->cfg.proto));
+
+                       if (log_check_level(DLSS7, LOGL_DEBUG)) {
+                               /* osmo_ss7_route_name() calls 
osmo_ss7_pointcode_print() and
+                                * osmo_ss7_pointcode_print2(), guard against 
its static buffer being
+                                * overwritten. */
+                               const char *rt_name = osmo_ss7_route_name(rt, 
false);
+                               DEBUGP(DLSS7, "Found route for dpc=%u=%s: %s\n",
+                                      dpc, osmo_ss7_pointcode_print(inst, 
dpc), rt_name);
+                       }
 
                        switch (as->cfg.proto) {
                        case OSMO_SS7_ASP_PROT_M3UA:
@@ -238,12 +241,16 @@
                                break;
                        }
                } else if (rt->dest.linkset) {
-                       LOGP(DLSS7, LOGL_ERROR,
-                            "Found route for dpc=%u=%s: pc=%u=%s mask=0x%x"
-                            " via linkset %s, but MTP-TRANSFER.req unsupported 
for linkset.\n",
-                            dpc, osmo_ss7_pointcode_print(inst, dpc),
-                            rt->cfg.pc, osmo_ss7_pointcode_print2(inst, 
rt->cfg.pc), rt->cfg.mask,
-                            rt->dest.linkset->cfg.name);
+                       if (log_check_level(DLSS7, LOGL_ERROR)) {
+                               /* osmo_ss7_route_name() calls 
osmo_ss7_pointcode_print() and
+                                * osmo_ss7_pointcode_print2(), guard against 
its static buffer being
+                                * overwritten. */
+                               const char *rt_name = osmo_ss7_route_name(rt, 
false);
+                               LOGP(DLSS7, LOGL_ERROR,
+                                    "Found route for dpc=%u=%s: %s,"
+                                    " but MTP-TRANSFER.req unsupported for 
linkset.\n",
+                                    dpc, osmo_ss7_pointcode_print(inst, dpc), 
rt_name);
+                       }
                } else
                        OSMO_ASSERT(0);
        } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae524c38cd91383a59c64bf7919d94ba7ff350bd
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <[email protected]>

Reply via email to