[MERGED] libosmo-sccp[master]: osmo_sccp_addr_name / _dump: drop 'NO_GT' output

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Dec 25 00:43:12 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: osmo_sccp_addr_name / _dump: drop 'NO_GT' output
......................................................................


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
---
M src/sccp_helpers.c
M tests/xua/xua_test.ok
2 files changed, 12 insertions(+), 10 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
 		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 @@
 		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 @@
 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 @@
 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=()

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9f87b2b703223ecb5d0442b6199c5b779fe544a1
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list