[PATCH] ifplugd: Allow ENODEV when upping interface for -M

Denys Vlasenko vda.linux at googlemail.com
Fri Aug 19 13:40:44 UTC 2016


Fixed in git, please try it.

On Thu, Aug 18, 2016 at 10:00 PM, Jate Sujjavanich <jatedev at gmail.com> wrote:
> I am able to reproduce the issue on my system consistently. I'm using
> modprobe to remove the driver for g_ether on my ARM system. Using strace
> reduces the frequency of the bug, but it still occurs.
>
> Here's the output from strace:
>
> 14:50:53.886676 ioctl(3, SIOCGIFFLAGS, {ifr_name="usb0",
> ifr_flags=IFF_BROADCAS
> T|IFF_MULTICAST}) = 0
> 14:50:53.887140 write(2, "ifplugd(usb0): upping interface\n",
> 32ifplugd(usb0):
> upping interface
> ) = 32
> 14:50:53.887584 gettimeofday({1471546253, 887734}, NULL) = 0
> 14:50:53.888011 send(5, "<27>Aug 18 14:50:53 ifplugd(usb0"..., 52,
> MSG_NOSIGNAL
> ) = 52
> 14:50:53.888431 ioctl(3, SIOCSIFFLAGS, {ifr_name="usb0", ???}) = -1 ENODEV
> (No
> such device)
> 14:50:53.895989 write(2, "ifplugd(usb0): setting interface"...,
> 62ifplugd(usb0)
> : setting interface flags failed: No such device
> ) = 62
>
>
> On Tue, Aug 16, 2016 at 7:52 PM, Denys Vlasenko <vda.linux at googlemail.com>
> wrote:
>>
>> On Thu, Aug 11, 2016 at 5:21 PM, Jate Sujjavanich <jatedev at gmail.com>
>> wrote:
>> > The following changes since commit
>> > 150dc7a2b483b8338a3e185c478b4b23ee884e71:
>> >
>> >   ntpd: respond only to client and symmetric active packets (2016-08-01
>> > 20:25:06 +0200)
>> >
>> > are available in the git repository at:
>> >
>> >   https://github.com/jatedev/busybox work-ifplugd-device-detect
>> >
>> > for you to fetch changes up to a5d29d0cc0ff79214465a66fc8cd49757bf72064:
>> >
>> >   ifplugd: Allow ENODEV when upping interface for -M (2016-08-11
>> > 11:09:21
>> > -0400)
>> >
>> > ----------------------------------------------------------------
>> > Jate Sujjavanich (1):
>> >       ifplugd: Allow ENODEV when upping interface for -M
>> >
>> >  networking/ifplugd.c |    6 +++++-
>> >  1 file changed, 5 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/networking/ifplugd.c b/networking/ifplugd.c
>> > index 28c49e2..67251ae 100644
>> > --- a/networking/ifplugd.c
>> > +++ b/networking/ifplugd.c
>> > @@ -359,7 +359,11 @@ static void up_iface(void)
>> >                 /* Let user know we mess up with interface */
>> >                 bb_error_msg("upping interface");
>> >                 if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting
>> > interface flags") < 0)
>> > -                       xfunc_die();
>> > +                       if (errno == ENODEV) {
>> > +                               G.iface_exists = 0;
>> > +                               return;
>> > +                       } else
>> > +                               xfunc_die();
>> >         }
>>
>> This makes sense. But...
>>
>>         set_ifreq_to_ifname(&ifrequest);
>>         if (network_ioctl(SIOCGIFFLAGS, &ifrequest, "getting interface
>> flags") < 0) {
>>                 G.iface_exists = 0;
>>                 return;
>>         }
>>
>>         if (!(ifrequest.ifr_flags & IFF_UP)) {
>>                 ifrequest.ifr_flags |= IFF_UP;
>>                 /* Let user know we mess up with interface */
>>                 bb_error_msg("upping interface");
>>                 if (network_ioctl(SIOCSIFFLAGS, &ifrequest, "setting
>> interface flags") < 0) {
>>
>>
>>
>> I just wonder, how on Earth SIOCGIFFLAGS just above did _not_ fail?
>> The iface deletion race? Very tight, almost impossible to hit...
>
>


More information about the busybox mailing list