Netdev List
 help / color / mirror / Atom feed
* netlink, RTM_NEWTCLASS, nested attributes
@ 2013-02-19 21:45 Denys Fedoryshchenko
  2013-02-20 23:21 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Denys Fedoryshchenko @ 2013-02-19 21:45 UTC (permalink / raw)
  To: netdev, pablo, jhs, davem, linux-kernel

Hi

I tried recently to write my own tool based on amazing libmnl (which 
makes understanding of netlink - easy), written
by Pablo Neira Ayuso, to manage QoS in Linux and faced problem, which i 
think probably
a bug in handling netlink messages in kernel.

For example if i send message, RTM_NEWTCLASS, after attribute 
TCA_OPTIONS i have nested attributes,
for example in HTB: TCA_HTB_PARMS, TCA_HTB_RTAB, TCA_HTB_CTAB.
libmnl, if i use nested attribute, adding a bit to it, by OR -  
NLA_F_NESTED(1 << 15).
If i remove this flag - everything works fine. And here is the case, 
iproute2 tools
just update length of TCA_OPTIONS, without setting flag, and it works 
because of that fine too.

So there is basically 3 solutions:
1)New function in libmnl to do nested attributes without setting by OR 
flag
2)AND-ing attribute type in kernel to ignore nested flag
3)Keeping as is, who cares?

Thank you for your attention.

---
Denys Fedoryshchenko, Network Engineer, Virtual ISP S.A.L.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: netlink, RTM_NEWTCLASS, nested attributes
  2013-02-19 21:45 netlink, RTM_NEWTCLASS, nested attributes Denys Fedoryshchenko
@ 2013-02-20 23:21 ` Stephen Hemminger
  2013-02-20 23:24   ` Denys Fedoryshchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2013-02-20 23:21 UTC (permalink / raw)
  To: Denys Fedoryshchenko; +Cc: netdev, pablo, jhs, davem, linux-kernel

On Tue, 19 Feb 2013 23:45:25 +0200
Denys Fedoryshchenko <denys@visp.net.lb> wrote:

> Hi
> 
> I tried recently to write my own tool based on amazing libmnl (which 
> makes understanding of netlink - easy), written
> by Pablo Neira Ayuso, to manage QoS in Linux and faced problem, which i 
> think probably
> a bug in handling netlink messages in kernel.
> 
> For example if i send message, RTM_NEWTCLASS, after attribute 
> TCA_OPTIONS i have nested attributes,
> for example in HTB: TCA_HTB_PARMS, TCA_HTB_RTAB, TCA_HTB_CTAB.
> libmnl, if i use nested attribute, adding a bit to it, by OR -  
> NLA_F_NESTED(1 << 15).
> If i remove this flag - everything works fine. And here is the case, 
> iproute2 tools
> just update length of TCA_OPTIONS, without setting flag, and it works 
> because of that fine too.
> 
> So there is basically 3 solutions:
> 1)New function in libmnl to do nested attributes without setting by OR 
> flag
> 2)AND-ing attribute type in kernel to ignore nested flag
> 3)Keeping as is, who cares?
> 

Several legacy netlink interfaces don't use NESTED flag. These are by
now enshrined in ABI and can't change. In code, that uses libmnl, I just
manually clear the flag as needed and document why. This could
be added to libmnl.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: netlink, RTM_NEWTCLASS, nested attributes
  2013-02-20 23:21 ` Stephen Hemminger
@ 2013-02-20 23:24   ` Denys Fedoryshchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Denys Fedoryshchenko @ 2013-02-20 23:24 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, pablo, jhs, davem, linux-kernel

On 2013-02-21 01:21, Stephen Hemminger wrote:
> On Tue, 19 Feb 2013 23:45:25 +0200
> Denys Fedoryshchenko <denys@visp.net.lb> wrote:
>
>> Hi
>>
>> I tried recently to write my own tool based on amazing libmnl (which
>> makes understanding of netlink - easy), written
>> by Pablo Neira Ayuso, to manage QoS in Linux and faced problem, 
>> which i
>> think probably
>> a bug in handling netlink messages in kernel.
>>
>> For example if i send message, RTM_NEWTCLASS, after attribute
>> TCA_OPTIONS i have nested attributes,
>> for example in HTB: TCA_HTB_PARMS, TCA_HTB_RTAB, TCA_HTB_CTAB.
>> libmnl, if i use nested attribute, adding a bit to it, by OR -
>> NLA_F_NESTED(1 << 15).
>> If i remove this flag - everything works fine. And here is the case,
>> iproute2 tools
>> just update length of TCA_OPTIONS, without setting flag, and it 
>> works
>> because of that fine too.
>>
>> So there is basically 3 solutions:
>> 1)New function in libmnl to do nested attributes without setting by 
>> OR
>> flag
>> 2)AND-ing attribute type in kernel to ignore nested flag
>> 3)Keeping as is, who cares?
>>
>
> Several legacy netlink interfaces don't use NESTED flag. These are by
> now enshrined in ABI and can't change. In code, that uses libmnl, I 
> just
> manually clear the flag as needed and document why. This could
> be added to libmnl.

Thank you for clarification!

---
Denys Fedoryshchenko, Network Engineer, Virtual ISP S.A.L.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-20 23:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-19 21:45 netlink, RTM_NEWTCLASS, nested attributes Denys Fedoryshchenko
2013-02-20 23:21 ` Stephen Hemminger
2013-02-20 23:24   ` Denys Fedoryshchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox