RTE_ACL_FIELD_TYPE_RANGE is for linear integer range like port numbers For ip addresses RTE_ACL_FIELD_TYPE_MASK should be used.
On Tue, Jun 20, 2017 at 1:57 PM, 이두환 <[email protected]> wrote: > Hello everyone. > > I want to implement some feature like ACL using DPDK ACL library. > so, I defined rule like below. > > struct acl_match_component > { > uint8_t protocol; > uint32_t sip; > uint32_t dip; > uint16_t sport; > uint16_t dport; > uint16_t in_if; > uint16_t out_if; > } > > > struct rte_acl_field_def ipv4_defs[7] = { > { > .type = RTE_ACL_FIELD_TYPE_RANGE, > .size = sizeof(uint8_t), > .field_index = 0, > .input_index = 0, > .offset = 0 > }, > { > .type = RTE_ACL_FIELD_TYPE_RANGE, > .size = sizeof(uint32_t), > .field_index = 1, > .input_index = 1, > .offset = offsetof(struct acl_match_component, sip) > }, > { > .type = RTE_ACL_FIELD_TYPE_RANGE, > .size = sizeof(uint32_t), > .field_index = 2, > .input_index = 2, > .offset = offsetof(struct acl_match_component, dip) > }, > { > .type = RTE_ACL_FIELD_TYPE_RANGE, > .size = sizeof(uint16_t), > .field_index = 3, > .input_index = 3, > .offset = offsetof(struct acl_match_component, sport) > }, > { > .type = RTE_ACL_FIELD_TYPE_RANGE, > .size = sizeof(uint16_t), > .field_index = 4, > .input_index = 3, > .offset = offsetof(struct acl_match_component, dport) > }, > { > .type = RTE_ACL_FIELD_TYPE_RANGE, > .size = sizeof(uint16_t), > .field_index = 5, > .input_index = 4, > .offset = offsetof(struct acl_match_component, in_if) > }, > { > .type = RTE_ACL_FIELD_TYPE_RANGE, > .size = sizeof(uint16_t), > .field_index = 6, > .input_index = 4, > .offset = offsetof(struct acl_match_component, out_if) > }, > }; > > I defined 32bit IPv4 address filed as RTE_ACL_FIELD_TYPE_RANGE type. > and I set rte_acl_field for IP field like below. > > value.u32 = IPv4(10,10,10,10); > mask_range.u32 = IPv4(20,20,20,20); > > In this case, I think IP 10.10.10.15 and 10.10.10.30 should be matched. > but result was IP 10.10.10.15 was matched and 10.10.10.30 was not matched. > > I am using DPDK 16.04 and there was no example in the DPDK source using > 32bit field as range type. > Range type with 16bit field (ex. port number) works well. > And, DPDK 17.05 has no meaningful changes on ACL library compare to DPDK > 16.04 > > Do you have any idea about this? > > Thank you. >
