aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/bsc-nat/bsc_nat_test.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-01-30 11:53:30 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:06 +0800
commit1d6fb18b57f5c04f768262a4f7dfabdadf7a54b1 (patch)
tree2cbb09e2516ea9c6e9d084de6032e88712140f1d /openbsc/tests/bsc-nat/bsc_nat_test.c
parent0b8f69d83957924ac9150693140c31a77a21476a (diff)
[nat] Specify the direction of the message
Do not run into the situation where we need to filter in one direction but it should not be filtered..
Diffstat (limited to 'openbsc/tests/bsc-nat/bsc_nat_test.c')
-rw-r--r--openbsc/tests/bsc-nat/bsc_nat_test.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index 282f2515..8d1bd9b8 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -90,6 +90,7 @@ static const u_int8_t bssmap_release_complete[] = {
struct filter_result {
const u_int8_t *data;
const u_int16_t length;
+ const int dir;
const int result;
};
@@ -97,42 +98,50 @@ static const struct filter_result results[] = {
{
.data = ipa_id,
.length = ARRAY_SIZE(ipa_id),
- .result = FILTER_TO_MSC,
+ .dir = DIR_MSC,
+ .result = 1,
},
{
.data = gsm_reset,
.length = ARRAY_SIZE(gsm_reset),
- .result = FILTER_TO_MSC,
+ .dir = DIR_MSC,
+ .result = 1,
},
{
.data = gsm_reset_ack,
.length = ARRAY_SIZE(gsm_reset_ack),
- .result = FILTER_TO_BSC,
+ .dir = DIR_BSC,
+ .result = 1,
},
{
.data = gsm_paging,
.length = ARRAY_SIZE(gsm_paging),
- .result = FILTER_NONE,
+ .dir = DIR_BSC,
+ .result = 0,
},
{
.data = bssmap_cr,
.length = ARRAY_SIZE(bssmap_cr),
- .result = FILTER_NONE,
+ .dir = DIR_MSC,
+ .result = 0,
},
{
.data = bssmap_cc,
.length = ARRAY_SIZE(bssmap_cc),
- .result = FILTER_NONE,
+ .dir = DIR_BSC,
+ .result = 0,
},
{
.data = bssmap_released,
.length = ARRAY_SIZE(bssmap_released),
- .result = FILTER_NONE,
+ .dir = DIR_MSC,
+ .result = 0,
},
{
.data = bssmap_release_complete,
.length = ARRAY_SIZE(bssmap_release_complete),
- .result = FILTER_NONE,
+ .dir = DIR_BSC,
+ .result = 0,
},
};
@@ -157,7 +166,7 @@ int main(int argc, char **argv)
continue;
}
- result = bsc_nat_filter_ipa(msg, parsed);
+ result = bsc_nat_filter_ipa(results[i].dir, msg, parsed);
if (result != results[i].result) {
fprintf(stderr, "FAIL: Not the expected result got: %d wanted: %d\n",
result, results[i].result);