diff options
author | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-03-20 11:11:19 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-03-22 17:33:09 +0000 |
commit | b5395729c7b08c88f2e520c06b0edec28d3a1fe1 (patch) | |
tree | 8eaa6ef43d59bebd649351295bdf11224b26dac1 /src/plugins/acl/hash_lookup.c | |
parent | 063dfa1587a58319fac139eab5e655ad1c555e33 (diff) |
acl-plugin: get rid of a separate "count" field in the linear acl struct
Long time ago, the linear array of rules in the ACL structure was not
a vector. Now it is, so get rid of the extraneous "count" member.
Do so in a manner that would ease potential the MP-safe manipulation of
ACL rules in the future.
Change-Id: Ib9c0731e4f21723c9ec4d7f00c3e5ead8e1e97bd
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/plugins/acl/hash_lookup.c')
-rw-r--r-- | src/plugins/acl/hash_lookup.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/acl/hash_lookup.c b/src/plugins/acl/hash_lookup.c index ff671d1c092..ccae26453d3 100644 --- a/src/plugins/acl/hash_lookup.c +++ b/src/plugins/acl/hash_lookup.c @@ -1182,7 +1182,7 @@ void hash_acl_add(acl_main_t *am, int acl_index) void *oldheap = hash_acl_set_heap(am); DBG("HASH ACL add : %d", acl_index); int i; - acl_list_t *a = &am->acls[acl_index]; + acl_rule_t *acl_rules = am->acls[acl_index].rules; vec_validate(am->hash_acl_infos, acl_index); hash_acl_info_t *ha = vec_elt_at_index(am->hash_acl_infos, acl_index); clib_memset(ha, 0, sizeof(*ha)); @@ -1192,19 +1192,19 @@ void hash_acl_add(acl_main_t *am, int acl_index) is a mask type, increment a reference count for that mask type */ /* avoid small requests by preallocating the entire vector before running the additions */ - if (a->count > 0) { - vec_validate(ha->rules, a->count-1); + if (vec_len(acl_rules) > 0) { + vec_validate(ha->rules, vec_len(acl_rules)-1); vec_reset_length(ha->rules); } - for(i=0; i < a->count; i++) { + for(i=0; i < vec_len(acl_rules); i++) { hash_ace_info_t ace_info; fa_5tuple_t mask; clib_memset(&ace_info, 0, sizeof(ace_info)); ace_info.acl_index = acl_index; ace_info.ace_index = i; - make_mask_and_match_from_rule(&mask, &a->rules[i], &ace_info); + make_mask_and_match_from_rule(&mask, &acl_rules[i], &ace_info); mask.pkt.flags_reserved = 0b000; ace_info.base_mask_type_index = assign_mask_type_index(am, &mask); /* assign the mask type index for matching itself */ |