Using libnl to create u32 hashkey
Adrian Ban
adrian.ban at mantech.ro
Tue Nov 22 07:13:34 EST 2011
Hi,
I'll build a patch after I'll test the link attribute too :). 2 in 1.
Best regards,
Adrian
On 11/22/2011 2:07 PM, Thomas Graf wrote:
> On Tue, Nov 22, 2011 at 01:46:30PM +0200, Adrian Ban wrote:
>> Hi,
>>
>> I saw that. For this reason I've made a function that set the divisor:
>>
>> #include<netlink/netlink.h>
>> #include<netlink/route/tc.h>
>> #include<netlink/route/classifier.h>
>> #include "include/rtnl_u32.h"
>>
>> int rtnl_u32_set_divisor(struct rtnl_cls *mycls, uint16_t divisor)
>> {
>>
>> struct rtnl_u32 *u;
>>
>> if (!(u = (struct rtnl_u32*)rtnl_tc_data(TC_CAST(mycls))))
>> return -NLE_NOMEM;
>>
>> printf("Mask before set : 0x%X\n", u->cu_mask);
>> u->cu_divisor = divisor;
>> u->cu_mask |= U32_ATTR_DIVISOR;
>> printf("Divisor is set to : 0x%X\n", u->cu_divisor);
>> printf("Mask is set to : 0x%X\n", u->cu_mask);
>> return 0;
>>
>> }
> Great, feel free to send patches.
More information about the libnl
mailing list