[PATCH alternative] ifplugd: fix netlink recv

walter harms wharms at bfs.de
Tue Jul 9 07:15:28 UTC 2013



Am 08.07.2013 23:20, schrieb Tito:
> On Monday 08 July 2013 13:28:29 Johannes Stezenbach wrote:
>> ifplugd exits with error on newer kernels:
>>
>> [ 1264.692730] libphy: eth0 - Link is Down
>> ifplugd(eth0): netlink packet too small or truncated
>> ifplugd(eth0): exiting
>>
>> I found a fix for a similar issue here, it increases
>> buffer size from 2048 to 4096:
>> https://bugs.launchpad.net/ubuntu/+source/ifmetric/+bug/896584
>>
>>
>> --- busybox-1.21.0/networking/ifplugd.c.orig	2012-12-22 23:39:01.000000000 +0100
>> +++ busybox-1.21.0/networking/ifplugd.c	2013-07-08 13:12:54.372062361 +0200
>> @@ -451,7 +451,7 @@ static smallint detect_link(void)
>>  static NOINLINE int check_existence_through_netlink(void)
>>  {
>>  	int iface_len;
>> -	char replybuf[1024];
>> +	char replybuf[4096];
>>  
>>  	iface_len = strlen(G.iface);
>>  	while (1) {
> 
> Hi,
> can you try if the attached patch fixes your problem.
> Compiled and tested on my box where it works (as before):
> 
> debian:~/Desktop/SourceCode/busybox$ ./busybox ifplugd -naIM eth0
> ifplugd(eth0): started: BusyBox v1.22.0.git (2013-06-30 11:08:29 CEST)
> ifplugd(eth0): using IFF_RUNNING detection mode
> ifplugd(eth0): interface exists
> ifplugd(eth0): link is up
> ifplugd(eth0): executing '/etc/ifplugd/ifplugd.action eth0 up'
> ifplugd(eth0): exit code: 255
> ifplugd(eth0): link is down
> ifplugd(eth0): executing '/etc/ifplugd/ifplugd.action eth0 down'
> ifplugd(eth0): exit code: 255
> ifplugd(eth0): link is up
> ifplugd(eth0): executing '/etc/ifplugd/ifplugd.action eth0 up'
> ifplugd(eth0): exit code: 255
> ^Cifplugd(eth0): executing '/etc/ifplugd/ifplugd.action eth0 down'
> ifplugd(eth0): exit code: 255
> ifplugd(eth0): exiting
> 
> Hope this helps.
> Ciao,
> Tito
> 
> 
> diff -uNp networking/ifplugd.c.orig networking/ifplugd.c 
> --- networking/ifplugd.c.orig   2013-07-08 22:51:22.748468426 +0200
> +++ networking/ifplugd.c        2013-07-08 22:52:45.687231145 +0200
> @@ -448,10 +448,12 @@ static smallint detect_link(void)
>         return status;
>  }
>  
> +#define MAX_PAYLOAD 1024  /* maximum payload size*/
> +
>  static NOINLINE int check_existence_through_netlink(void)
>  {
>         int iface_len;
> -       char replybuf[1024];
> +       char replybuf[NLMSG_SPACE(MAX_PAYLOAD)];
>  
>         iface_len = strlen(G.iface);
>         while (1) {
> 
> 

Hi Tito,
just for my curiosity could you please explain why this works ?
(To be fair i have an idea but i am not sure if that is true)

re,
 wh



More information about the busybox mailing list