diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-05-16 02:00:40 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-06-15 20:24:20 +0800 |
commit | 19c0a84fb863a73ce8ee388e3be8044b23069848 (patch) | |
tree | 14bd363d3cf432ff9948a2307c8bb6f83ba32a96 /openbsc/tests/bsc-nat/bsc_nat_test.c | |
parent | 66e1ef73c83844a26159befbcfb920d74c8741d5 (diff) |
[nat] Set the connection type/reason as out parameter
We are analyzing each CR message and it is nice to know the
reason these connections were created. Change the nat method.
Diffstat (limited to 'openbsc/tests/bsc-nat/bsc_nat_test.c')
-rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index 0ccd23f66..adc8a197a 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.c +++ b/openbsc/tests/bsc-nat/bsc_nat_test.c @@ -566,6 +566,7 @@ struct cr_filter { const u_int8_t *data; int length; int result; + int contype; const char *bsc_imsi_allow; const char *bsc_imsi_deny; @@ -577,16 +578,19 @@ static struct cr_filter cr_filter[] = { .data = bssmap_cr, .length = sizeof(bssmap_cr), .result = 0, + .contype = NAT_CON_TYPE_CM_SERV_REQ, }, { .data = bss_lu, .length = sizeof(bss_lu), .result = 0, + .contype = NAT_CON_TYPE_LU, }, { .data = pag_resp, .length = sizeof(pag_resp), .result = 0, + .contype = NAT_CON_TYPE_PAG_RESP, }, { /* nat deny is before blank/null BSC */ @@ -594,6 +598,7 @@ static struct cr_filter cr_filter[] = { .length = sizeof(bss_lu), .result = -3, .nat_imsi_deny = "[0-9]*", + .contype = NAT_CON_TYPE_LU, }, { /* BSC allow is before NAT deny */ @@ -602,6 +607,7 @@ static struct cr_filter cr_filter[] = { .result = 0, .nat_imsi_deny = "[0-9]*", .bsc_imsi_allow = "2440[0-9]*", + .contype = NAT_CON_TYPE_LU, }, { /* BSC allow is before NAT deny */ @@ -610,6 +616,7 @@ static struct cr_filter cr_filter[] = { .result = 0, .bsc_imsi_allow = "[0-9]*", .nat_imsi_deny = "[0-9]*", + .contype = NAT_CON_TYPE_LU, }, { /* filter as deny is first */ @@ -619,13 +626,14 @@ static struct cr_filter cr_filter[] = { .bsc_imsi_deny = "[0-9]*", .bsc_imsi_allow = "[0-9]*", .nat_imsi_deny = "[0-9]*", + .contype = NAT_CON_TYPE_LU, }, }; static void test_cr_filter() { - int i, res; + int i, res, contype; struct msgb *msg = msgb_alloc(4096, "test_cr_filter"); struct bsc_nat_parsed *parsed; @@ -653,12 +661,17 @@ static void test_cr_filter() abort(); } - res = bsc_nat_filter_sccp_cr(bsc, msg, parsed); + res = bsc_nat_filter_sccp_cr(bsc, msg, parsed, &contype); if (res != cr_filter[i].result) { fprintf(stderr, "FAIL: Wrong result %d for test %d.\n", res, i); abort(); } + if (contype != cr_filter[i].contype) { + fprintf(stderr, "FAIL: Wrong contype %d for test %d.\n", res, contype); + abort(); + } + talloc_free(parsed); } |