Skip to contentSkip to conversation

Why doesn`t test-acl work when IP filed is RTE_ACL_FIELD_TYPE_RANGE?

DISCUSSION Gyumin 1 participant 2 messages Jun 17, 2015

lore
Share & tools
lore

Gyumin

author
#0 lore raw

hi,

I ran test-acl without any modification and it worked well, and I modified test-acl like below:
{
//.type = RTE_ACL_FIELD_TYPE_MASK,
.type = RTE_ACL_FIELD_TYPE_RANGE,
.size = sizeof(uint32_t),
.field_index = SRC_FIELD_IPV4,
.input_index = RTE_ACL_IPV4VLAN_SRC,
.offset = offsetof(struct ipv4_5tuple, ip_src),
},
{
//.type = RTE_ACL_FIELD_TYPE_MASK,
.type = RTE_ACL_FIELD_TYPE_RANGE,
.size = sizeof(uint32_t),
.field_index = DST_FIELD_IPV4,
.input_index = RTE_ACL_IPV4VLAN_DST,
.offset = offsetof(struct ipv4_5tuple, ip_dst),
},

static int
parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len)

  {
    uint8_t a, b, c, d, m;

    GET_CB_FIELD(in, a, 0, UINT8_MAX, '.');
    GET_CB_FIELD(in, b, 0, UINT8_MAX, '.');
    GET_CB_FIELD(in, c, 0, UINT8_MAX, '.');
    GET_CB_FIELD(in, d, 0, UINT8_MAX, '/');
    //GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0);
    GET_CB_FIELD(in, m, 0, 4294967295, 0);

    addr[0] = IPv4(a, b, c, d);
    mask_len[0] = m;

    printf("m[%d]\n", m);

    return 0;

}

test-acl didn`t match any rules when I ran modified test-acl. Here are my rule and trace file:
cat rule1.range
@192.168.0.1/100 192.168.0.0/24 400 : 500 0 : 52 6/0xff
cat trace1
0xc0a80005 0xc0a80009 450 53 0x06

Is there anything that I`m missing?

author
#1 lore raw

ok, I notice now that my rule file was wrong.
I modified the range of SIP/DIP like the value of SIP/DIP (like 192.168.10.100), and it works!