summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-12-24 16:22:39 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2017-12-24 16:52:53 +0100
commited287f2b878cadd49d2673cb650f0d603ddb0d9c (patch)
tree179d89468cb7ca5120ba6277445a63c77c4ce58b
parent1aa2a42eae63eaf591306e5a5021fc5453de6da9 (diff)
osmo_sccp_addr_name / _dump: drop 'NO_GT' output
Do not print the GTI if gti is set to OSMO_SCCP_GTI_NO_GT and no GT is present in the address. If addr->gt.gti is set to OSMO_SCCP_GTI_NO_GT, i.e. currently always, osmo_sccp_addr_name() and osmo_sccp_addr_dump() output ",GTI=NO_GT" in every address dump, which is useless clutter. Drop that. However, if a Global Title is flagged in addr->presence, still output the GTI to highlight situations where GTI might mismatch the presence of a GT. Change-Id: I9f87b2b703223ecb5d0442b6199c5b779fe544a1
-rw-r--r--src/sccp_helpers.c6
-rw-r--r--tests/xua/xua_test.ok16
2 files changed, 12 insertions, 10 deletions
diff --git a/src/sccp_helpers.c b/src/sccp_helpers.c
index cafca94..b7446e0 100644
--- a/src/sccp_helpers.c
+++ b/src/sccp_helpers.c
@@ -300,7 +300,8 @@ char *osmo_sccp_addr_dump(const struct osmo_sccp_addr *addr)
append_to_buf(buf, sizeof(buf), &comma, "SSN=%u", addr->ssn);
if (addr->presence & OSMO_SCCP_ADDR_T_IPv4)
append_to_buf(buf, sizeof(buf), &comma, "IP=%s", inet_ntoa(addr->ip.v4));
- append_to_buf(buf, sizeof(buf), &comma, "GTI=%u", addr->gt.gti);
+ if (addr->gt.gti != OSMO_SCCP_GTI_NO_GT || addr->presence & OSMO_SCCP_ADDR_T_GT)
+ append_to_buf(buf, sizeof(buf), &comma, "GTI=%u", addr->gt.gti);
if (addr->presence & OSMO_SCCP_ADDR_T_GT)
append_to_buf(buf, sizeof(buf), &comma, "GT=(%s)", osmo_sccp_gt_dump(&addr->gt));
@@ -323,7 +324,8 @@ char *osmo_sccp_addr_name(const struct osmo_ss7_instance *ss7, const struct osmo
append_to_buf(buf, sizeof(buf), &comma, "SSN=%s", osmo_sccp_ssn_name(addr->ssn));
if (addr->presence & OSMO_SCCP_ADDR_T_IPv4)
append_to_buf(buf, sizeof(buf), &comma, "IP=%s", inet_ntoa(addr->ip.v4));
- append_to_buf(buf, sizeof(buf), &comma, "GTI=%s", osmo_sccp_gti_name(addr->gt.gti));
+ if (addr->gt.gti != OSMO_SCCP_GTI_NO_GT || addr->presence & OSMO_SCCP_ADDR_T_GT)
+ append_to_buf(buf, sizeof(buf), &comma, "GTI=%s", osmo_sccp_gti_name(addr->gt.gti));
if (addr->presence & OSMO_SCCP_ADDR_T_GT)
append_to_buf(buf, sizeof(buf), &comma, "GT=(%s)", osmo_sccp_gt_dump(&addr->gt));
diff --git a/tests/xua/xua_test.ok b/tests/xua/xua_test.ok
index 472c02b..83b8b8d 100644
--- a/tests/xua/xua_test.ok
+++ b/tests/xua/xua_test.ok
@@ -7,8 +7,8 @@ sccp_addr_parse test case 1
expected: RI=1,SSN=8,GTI=4,GT=(TT=0,NPL=1,NAI=4,DIG=919869299992)
parsed: RI=1,SSN=8,GTI=4,GT=(TT=0,NPL=1,NAI=4,DIG=919869299992)
sccp_addr_parse test case 2
-expected: RI=2,SSN=254,GTI=0
-parsed: RI=2,SSN=254,GTI=0
+expected: RI=2,SSN=254
+parsed: RI=2,SSN=254
Testing Decoded GT -> SUA encoding
IN: TT=0,NPL=1,NAI=4,DIG=919969679389
0400000001000000040000003931393936393637393338390000000000000000000000000000000000000000
@@ -135,25 +135,25 @@ Parsing Nested M3UA Routing Key IE
Testing SCCP Address Encode/Decode
=> NOGT-PC1024
-input addr: RI=2,PC=1024,GTI=0
+input addr: RI=2,PC=1024
rc=3, expected rc=3
encoded addr: 410004
expected addr: 410004
-decod addr: RI=2,PC=1024,GTI=0
+decod addr: RI=2,PC=1024
=> NOGT-PC16383
-input addr: RI=2,PC=16383,GTI=0
+input addr: RI=2,PC=16383
rc=3, expected rc=3
encoded addr: 41ff3f
expected addr: 41ff3f
-decod addr: RI=2,PC=16383,GTI=0
+decod addr: RI=2,PC=16383
=> NOGT-PC16383-SSN90
-input addr: RI=2,PC=16383,SSN=90,GTI=0
+input addr: RI=2,PC=16383,SSN=90
rc=4, expected rc=4
encoded addr: 43ff3f5a
expected addr: 43ff3f5a
-decod addr: RI=2,PC=16383,SSN=90,GTI=0
+decod addr: RI=2,PC=16383,SSN=90
=> GT-PC16383-NAIONLY
input addr: RI=2,PC=16383,GTI=1,GT=()