U32 filter add hash-table test fails

Sagi Lowenhardt sagil at infinidat.com
Wed Feb 25 07:46:11 PST 2015


I also fail to delete filters hash-table using libnl.
I try to do so by getting filters (cls) cache, and deleting each of
the objects in the cache by iterating them.
All the filters are deleted except for the ht which aren't.
As I try to delete the ht object using 'rtnl_cls_delete()' the
returned code is : 'NLE_INVAL' (7)

Looks like the cls object handle is (xxx::), meaning no specific id.
All attributes are set for the object (ifindex, prio, protocol, handle
& parent) which should be fine for 'rtnl_cls_delete()'.

Here is the ht as shown by 'tc filter show dev..'
filter parent 1: protocol ip pref 9200 u32 fh 801: ht divisor 1

Is there another way of deleting this object ?

Thank you


On Mon, Jan 26, 2015 at 9:06 AM, Sagi Lowenhardt <sagil at infinidat.com> wrote:
> 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



-- 
SAGI LOWENHARDT



More information about the libnl mailing list