U32 classifier and new hashing support

A C bsderandrew at gmail.com
Fri May 25 13:43:00 EDT 2012


On Fri, May 25, 2012 at 5:15 AM, Adrian Ban <adrian.ban at mantech.ro> wrote:
> Another reason that I've build the rtnl_u32_set_flags function is that in
> the rtnl_u32_set_flags is setting U32_ATTR_SELECTOR flag which I guess is
> not required (I don't remember anymore because the patch I've made in
> November 2011) to the terminal class.
> You can take a look in the iproute2/tc command and check this.
>
> Best regards,
> Adrian Ban

I'm not sure I agree on U32_ATTR_SELECTOR.  If U32_ATTR_SELECTOR isn't
set, then TCA_U32_SEL is never going to get added to the netlink msg,
and the selector flag added by rtnl_u32_set_cls_terminal won't make it
down to the kernel.

Also, my question was more in regards to this:

 439 int rtnl_u32_set_cls_terminal(struct rtnl_cls *cls)
 440 {
 441         struct rtnl_u32 *u;
 442         struct tc_u32_sel *sel;
 443         int err;
 444
 445         if (!(u = (struct rtnl_u32 *) rtnl_tc_data(TC_CAST(cls))))
 446                 return -NLE_NOMEM;
 447
 448         sel = u32_selector_alloc(u);
 449         if (!sel)
 450                 return -NLE_NOMEM;
 451
 452         err = nl_data_append(u->cu_selector, NULL, sizeof(struct
tc_u32_key));
 453         if(err < 0)
 454                 return err;
 455
 456         sel = u32_selector(u);
 457
 458         sel->flags |= TC_U32_TERMINAL;
 459         return 0;
 460 }

The code between lines 451 and 457 seems unnecessary, it's adding an
empty key as far as I can tell (rtnl_u32_set_hashmask has the same
issue).  Is this the case or am I just missing something obvious?



More information about the libnl mailing list