diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-06-08 10:53:39 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-06-08 10:53:39 +0800 |
commit | 299d5aa2a4edd54c9fb08c0343b8f685499439eb (patch) | |
tree | 286f07ad06c05ace62847a4315b9ebba8376dd0a /openbsc/tests | |
parent | f85e93cd4dffbfaa76bb9e81ced9667fb373c25f (diff) |
nat: Allow to specify multiple entries in the access-list...
Inside the access-list we have a list of entries that have
either one allow or one deny rule... we do not allow to remove
a single rule but one has to remove the whole list, in that case
talloc will handle cleaning all entries.
Right now the matching is O(n*m) as we traverse the list
(multiple times) and run the regexp multiple times. One
way to make it faster would be to concat all regexps into
one.
Diffstat (limited to 'openbsc/tests')
-rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index dfb77bfdb..0c5b8fd51 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.c +++ b/openbsc/tests/bsc-nat/bsc_nat_test.c @@ -641,6 +641,7 @@ static void test_cr_filter() struct msgb *msg = msgb_alloc(4096, "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 *nat = bsc_nat_alloc(); struct bsc_connection *bsc = bsc_connection_alloc(nat); @@ -648,6 +649,12 @@ static void test_cr_filter() bsc->cfg->acc_lst_name = "bsc"; nat->acc_lst_name = "nat"; + nat_lst = bsc_nat_acc_lst_get(nat, "nat"); + bsc_lst = bsc_nat_acc_lst_get(nat, "bsc"); + + bsc_entry = bsc_nat_acc_lst_entry_create(bsc_lst); + nat_entry = bsc_nat_acc_lst_entry_create(nat_lst); + for (i = 0; i < ARRAY_SIZE(cr_filter); ++i) { msgb_reset(msg); copy_to_msg(msg, cr_filter[i].data, cr_filter[i].length); @@ -655,13 +662,13 @@ static void test_cr_filter() nat_lst = bsc_nat_acc_lst_get(nat, "nat"); bsc_lst = bsc_nat_acc_lst_get(nat, "bsc"); - bsc_parse_reg(nat_lst, &nat_lst->imsi_deny_re, &nat_lst->imsi_deny, + bsc_parse_reg(nat_entry, &nat_entry->imsi_deny_re, &nat_entry->imsi_deny, cr_filter[i].nat_imsi_deny ? 1 : 0, &cr_filter[i].nat_imsi_deny); - bsc_parse_reg(bsc_lst, &bsc_lst->imsi_allow_re, &bsc_lst->imsi_allow, + bsc_parse_reg(bsc_entry, &bsc_entry->imsi_allow_re, &bsc_entry->imsi_allow, cr_filter[i].bsc_imsi_allow ? 1 : 0, &cr_filter[i].bsc_imsi_allow); - bsc_parse_reg(bsc_lst, &bsc_lst->imsi_deny_re, &bsc_lst->imsi_deny, + bsc_parse_reg(bsc_entry, &bsc_entry->imsi_deny_re, &bsc_entry->imsi_deny, cr_filter[i].bsc_imsi_deny ? 1 : 0, &cr_filter[i].bsc_imsi_deny); |