From d77c8171aa22585a46cc9fdff4734a2b6b4f35f1 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 8 Jun 2010 10:53:39 +0800 Subject: 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. --- openbsc/tests/bsc-nat/bsc_nat_test.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'openbsc/tests/bsc-nat/bsc_nat_test.c') diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index 4a4311963..224406ea8 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); -- cgit v1.2.3