[PATCH] ifplugd: fix netlink recv
Tito
farmatito at tiscali.it
Mon Jul 8 14:10:31 UTC 2013
On Monday 08 July 2013 15:12:23 Johannes Stezenbach wrote:
> On Mon, Jul 08, 2013 at 03:04:19PM +0200, Johannes Stezenbach wrote:
> > On Mon, Jul 08, 2013 at 02:30:20PM +0200, walter harms wrote:
> > >
> > > strange,
> > > did the paket size change unexpectedly ?
> > > i do not believe so.
> > >
> > > Is 4k really the minimum size ?
> >
> > Please do not stop post.
> >
> > I have not researched this into every detail, all I know
> > is that this change fixes it. My kernel version is 3.9.9.
>
> Sorry, sent too soon. I want to add that 2048 also
> seems to work for ifplugd, but since in the ifmetric
> bug 2048 was too small, I also choose 4096 for ifplugd.
> I'm not sure if the netlink packet size is different for
> ifmetric or if it depends on other things like kernel config
> or type of interface. So I choose 4096 to be on the safe side,
> since I don't have the time to properly research netlink operation.
>
> Thanks,
> Johannes
Hi
seems to be related to PAGE_SIZE, see
include/linux/netlink.h
/*
88 * skb should fit one page. This choice is good for headerless malloc.
89 * But we should limit to 8K so that userspace does not have to
90 * use enormous buffer sizes on recvmsg() calls just to avoid
91 * MSG_TRUNC when PAGE_SIZE is very large.
92 */
93 #if PAGE_SIZE < 8192UL
94 #define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE)
95 #else
96 #define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL)
97 #endif
98
99 #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
100
so we should use a buffer of min PAGE_SIZE and max 8192UL.
Maybe it could be detected at runtime with getpagesize and malloced?
Ciao,
Tito
More information about the busybox
mailing list