diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-12-17 14:35:03 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-01-07 15:02:34 +0100 |
commit | bdf764a0255ebef0593b5c39a5118278d1a17d50 (patch) | |
tree | 2d50cd15795fe5b0bf81078c12efa85d1137b610 /openbsc/tests/bsc-nat | |
parent | adc2e8737235fd5f1655ba1a319d3aab76f16d91 (diff) |
nat: Allow the filter to select the reject cause
In preparation for another kind of black-list allow the filter code
to decide how the connection should be rejected. Introduce a new struct
that will carry the reject causes for certain operations.
Diffstat (limited to 'openbsc/tests/bsc-nat')
-rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index f8ba57b8a..59d92bd07 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.c +++ b/openbsc/tests/bsc-nat/bsc_nat_test.c @@ -1,8 +1,8 @@ /* * BSC NAT Message filtering * - * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org> - * (C) 2010 by On-Waves + * (C) 2010-2012 by Holger Hans Peter Freyther <zecke@selfish.org> + * (C) 2010-2012 by On-Waves * * All Rights Reserved * @@ -761,6 +761,7 @@ static void test_cr_filter() struct bsc_nat_parsed *parsed; struct bsc_nat_acc_lst *nat_lst, *bsc_lst; struct bsc_nat_acc_lst_entry *nat_entry, *bsc_entry; + struct bsc_nat_reject_cause cause; struct bsc_nat *nat = bsc_nat_alloc(); struct bsc_connection *bsc = bsc_connection_alloc(nat); @@ -802,7 +803,8 @@ static void test_cr_filter() abort(); } - res = bsc_nat_filter_sccp_cr(bsc, msg, parsed, &contype, &imsi); + memset(&cause, 0, sizeof(cause)); + res = bsc_nat_filter_sccp_cr(bsc, msg, parsed, &contype, &imsi, &cause); if (res != cr_filter[i].result) { printf("FAIL: Wrong result %d for test %d.\n", res, i); abort(); @@ -825,6 +827,7 @@ static void test_dt_filter() int i; struct msgb *msg = msgb_alloc(4096, "test_dt_filter"); struct bsc_nat_parsed *parsed; + struct bsc_nat_reject_cause cause; struct bsc_nat *nat = bsc_nat_alloc(); struct bsc_connection *bsc = bsc_connection_alloc(nat); @@ -854,7 +857,8 @@ static void test_dt_filter() abort(); } - if (bsc_nat_filter_dt(bsc, msg, con, parsed) != 1) { + memset(&cause, 0, sizeof(cause)); + if (bsc_nat_filter_dt(bsc, msg, con, parsed, &cause) != 1) { printf("FAIL: Should have passed..\n"); abort(); } @@ -869,7 +873,8 @@ static void test_dt_filter() continue; con->imsi_checked = 0; - bsc_nat_filter_dt(bsc, msg, con, parsed); + memset(&cause, 0, sizeof(cause)); + bsc_nat_filter_dt(bsc, msg, con, parsed, &cause); } } |