[PATCH alternative] ifplugd: fix netlink recv
js at sig21.net
Tue Jul 9 13:08:50 UTC 2013
On Tue, Jul 09, 2013 at 01:47:30PM +0200, Tito wrote:
> On Tuesday 09 July 2013 10:18:31 Harald Becker wrote:
> > On 09-07-2013 09:15 walter harms <wharms at bfs.de> wrote:
> > >just for my curiosity could you please explain why this works ?
> > NLMSG_SPACE(len) is a Macro to return the required buffer space
> > to carry a netlink message payload of given length. With the
> > maximum payload length you get the maximum required buffer space.
> > This is 1024 byte (as before) plus netlink message header size
> > plus header padding space ... usually less than 4096 byte ...
> > that is you do not waste unnecessary buffer space.
> yes this is the theory I came up with after digging through
> the linux/netlin.h header and looking at a few random examples of netlink
> code on the net.
It does not really work. The buffer size is then 1040 and the
actual message received is 1036 bytes (from strace) for
a normal eth0 interface. But running "ifplugd -nsfFaMIpq -i br0"
and then "brctl addbr br0" breaks it, the netlink message
So, where does the MAX_PAYLOAD == 1024 come from?
Without doing research on it, my assumption is that
in older kernels the message was smaller, and now it is
larger, and in future kernels the size might increase even more.
and it varies with the type of the interface.
And the point of using the netlink protocol is that messages
can be extended with additional attributes without breaking
Or is there some max size guaranteed for NETLINK_ROUTE messages
in group RTMGRP_LINK? If not, then the code needs to
be able to handle the max size of a netlink message.
More information about the busybox