U32 filter add hash-table test fails

Sagi Lowenhardt sagil at infinidat.com
Sun Jan 25 23:06:19 PST 2015


I've added qdisc HTB as root, a class and a qdisc below.

After that tried adding an HT using the method from the
"test-u32-filter-with-actions.c" which failed :

static
int u32_add_ht(struct nl_sock *sock, struct rtnl_link *rtnlLink,
uint32_t prio, uint32_t htid, uint32_t divisor)
{

    int err;
    struct rtnl_cls *cls;

    cls=rtnl_cls_alloc();
    if (!(cls)) {
        printf("Can not allocate classifier\n");
        nl_socket_free(sock);
        exit(1);
    }

    rtnl_tc_set_link(TC_CAST(cls), rtnlLink);

    if ((err = rtnl_tc_set_kind(TC_CAST(cls), "u32"))) {
        printf("Can not set classifier as u32\n");
        return 1;
    }

    rtnl_cls_set_prio(cls, prio);
    rtnl_cls_set_protocol(cls, ETH_P_IP);
    rtnl_tc_set_parent(TC_CAST(cls), TC_HANDLE(0xffff, 0));

    rtnl_u32_set_handle(cls, htid, 0x0, 0x0);
    //printf("htid: 0x%X\n", htid);
    rtnl_u32_set_divisor(cls, divisor);

    if ((err = rtnl_cls_add(sock, cls, NLM_F_CREATE))) {
        printf("Can not add classifier: %s\n", nl_geterror(err));
        return -1;
    }
    rtnl_cls_put(cls);
    return 0;
}

If I add a filter (and use rtnl_tc_set_handle()) , it finishes with no
issues, so the problem might be with the u32 handle or divisor.

On Sun, Jan 25, 2015 at 8:14 PM, Thomas Haller <thaller at redhat.com> wrote:
> On Sun, 2015-01-25 at 17:31 +0200, Sagi Lowenhardt wrote:
>> HI All,
>>
>> I've tried implementing my own method for creating hash-table for U32 filters.
>> I followed the test "test-u32-filter-with-actions.c" but I keep
>> getting err 7 (INVALID) when trying to execute "u32_add_ht" method.
>>
>> The error is returned as I try to add the filter.
>>
>> Are there any pre-conditions for adding hash-table ? (I know there
>> aren't when using the TC commands).
>
> I don't know, but could you show a working code to reproduce the
> failure?
>
>
> Thomas



-- 
SAGI LOWENHARDT



More information about the libnl mailing list