summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-26 18:16:11 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-26 18:17:28 +0100
commit039c7adcd5af78ebe93e82df26c2ceaaa9071517 (patch)
treeb34756fe723b002b10364a5e3952188a7f01717b
parent4698d27f4c035ab6bfedf6b0d72761648889369b (diff)
sccp: Add a test case for GTI creation, set the SSN indicator bit
Make sure that creating an address that should be routed based on the GTI can be created properly.
-rw-r--r--src/sccp.c2
-rw-r--r--tests/sccp/sccp_test.c21
2 files changed, 22 insertions, 1 deletions
diff --git a/src/sccp.c b/src/sccp.c
index 2845a58..c1cdc79 100644
--- a/src/sccp.c
+++ b/src/sccp.c
@@ -491,7 +491,7 @@ int sccp_create_sccp_addr(struct msgb *msg, const struct sockaddr_sccp *sock)
if (sock->gti)
- ai[0] = 0 << 6 | (sock->gti_ind & 0x0f) << 2;
+ ai[0] = 0 << 6 | (sock->gti_ind & 0x0f) << 2 | 1 << 1;
else
ai[0] = 1 << 6 | 1 << 1;
diff --git a/tests/sccp/sccp_test.c b/tests/sccp/sccp_test.c
index da1b081..8ef223e 100644
--- a/tests/sccp/sccp_test.c
+++ b/tests/sccp/sccp_test.c
@@ -914,6 +914,22 @@ static uint8_t poi_out[] = {
0x04, 0x43, 0x01, 0x00, 0xfe,
};
+static uint8_t gti_dat[] = {
+ 0x00, 0x12, 0x04, 0x53, 0x84, 0x09, 0x00, 0x17,
+};
+
+const struct sockaddr_sccp sccp_gti_bssap = {
+ .sccp_family = 0,
+ .sccp_ssn = 7,
+ .gti_ind = 4,
+ .gti_len = ARRAY_SIZE(gti_dat),
+ .gti = gti_dat,
+};
+
+static uint8_t gti_out[] = {
+ 0x0a, 0x12, 0x07, 0x00, 0x12, 0x04, 0x53, 0x84, 0x09, 0x00, 0x17,
+};
+
static struct sccp_addr_tst sccp_addr_tst[] = {
{
.addr = &sccp_ssn_bssap,
@@ -925,6 +941,11 @@ static struct sccp_addr_tst sccp_addr_tst[] = {
.output = poi_out,
.output_len = ARRAY_SIZE(poi_out),
},
+ {
+ .addr = &sccp_gti_bssap,
+ .output = gti_out,
+ .output_len = ARRAY_SIZE(gti_out),
+ },
};
static void test_sccp_address()