[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] ifplugd: Allow ENODEV when upping interface for -M
From:       Jate Sujjavanich <jatedev () gmail ! com>
Date:       2016-08-29 22:47:58
Message-ID: CAPphmga+vePbSdzH-_HAzWxzR0rk1TThdE+E5R7fk+JCc3Lo=g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I was finally able to try out the commit in busybox master. The patch
worked.

On Fri, Aug 19, 2016 at 9:40 AM, Denys Vlasenko <vda.linux@googlemail.com>
wrote:

> Fixed in git, please try it.
>
> On Thu, Aug 18, 2016 at 10:00 PM, Jate Sujjavanich <jatedev@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@googlemail.com>
> > wrote:
> >>
> >> On Thu, Aug 11, 2016 at 5:21 PM, Jate Sujjavanich <jatedev@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 a5d29d0cc0ff79214465a66fc8cd49
> 757bf72064:
> >> >
> >> >   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...
> >
> >
>

[Attachment #5 (text/html)]

<div dir="ltr">I was finally able to try out the commit in busybox master. The patch \
worked.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug \
19, 2016 at 9:40 AM, Denys Vlasenko <span dir="ltr">&lt;<a \
href="mailto:vda.linux@googlemail.com" \
target="_blank">vda.linux@googlemail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Fixed in git, please try it.<br> <div class="HOEnZb"><div \
class="h5"><br> On Thu, Aug 18, 2016 at 10:00 PM, Jate Sujjavanich &lt;<a \
href="mailto:jatedev@gmail.com">jatedev@gmail.com</a>&gt; wrote:<br> &gt; I am able \
to reproduce the issue on my system consistently. I&#39;m using<br> &gt; modprobe to \
remove the driver for g_ether on my ARM system. Using strace<br> &gt; reduces the \
frequency of the bug, but it still occurs.<br> &gt;<br>
&gt; Here&#39;s the output from strace:<br>
&gt;<br>
&gt; 14:50:53.886676 ioctl(3, SIOCGIFFLAGS, {ifr_name=&quot;usb0&quot;,<br>
&gt; ifr_flags=IFF_BROADCAS<br>
&gt; T|IFF_MULTICAST}) = 0<br>
&gt; 14:50:53.887140 write(2, &quot;ifplugd(usb0): upping interface\n&quot;,<br>
&gt; 32ifplugd(usb0):<br>
&gt; upping interface<br>
&gt; ) = 32<br>
&gt; 14:50:53.887584 gettimeofday({1471546253, 887734}, NULL) = 0<br>
&gt; 14:50:53.888011 send(5, &quot;&lt;27&gt;Aug 18 14:50:53 ifplugd(usb0&quot;..., \
52,<br> &gt; MSG_NOSIGNAL<br>
&gt; ) = 52<br>
&gt; 14:50:53.888431 ioctl(3, SIOCSIFFLAGS, {ifr_name=&quot;usb0&quot;, ???}) = -1 \
ENODEV<br> &gt; (No<br>
&gt; such device)<br>
&gt; 14:50:53.895989 write(2, &quot;ifplugd(usb0): setting interface&quot;...,<br>
&gt; 62ifplugd(usb0)<br>
&gt; : setting interface flags failed: No such device<br>
&gt; ) = 62<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Aug 16, 2016 at 7:52 PM, Denys Vlasenko &lt;<a \
href="mailto:vda.linux@googlemail.com">vda.linux@googlemail.com</a>&gt;<br> &gt; \
wrote:<br> &gt;&gt;<br>
&gt;&gt; On Thu, Aug 11, 2016 at 5:21 PM, Jate Sujjavanich &lt;<a \
href="mailto:jatedev@gmail.com">jatedev@gmail.com</a>&gt;<br> &gt;&gt; wrote:<br>
&gt;&gt; &gt; The following changes since commit<br>
&gt;&gt; &gt; 150dc7a2b483b8338a3e185c478b4b<wbr>23ee884e71:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     ntpd: respond only to client and symmetric active packets \
(2016-08-01<br> &gt;&gt; &gt; 20:25:06 +0200)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; are available in the git repository at:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     <a href="https://github.com/jatedev/busybox" rel="noreferrer" \
target="_blank">https://github.com/jatedev/<wbr>busybox</a> \
work-ifplugd-device-detect<br> &gt;&gt; &gt;<br>
&gt;&gt; &gt; for you to fetch changes up to \
a5d29d0cc0ff79214465a66fc8cd49<wbr>757bf72064:<br> &gt;&gt; &gt;<br>
&gt;&gt; &gt;     ifplugd: Allow ENODEV when upping interface for -M (2016-08-11<br>
&gt;&gt; &gt; 11:09:21<br>
&gt;&gt; &gt; -0400)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; ------------------------------<wbr>------------------------------<wbr>----<br>
 &gt;&gt; &gt; Jate Sujjavanich (1):<br>
&gt;&gt; &gt;           ifplugd: Allow ENODEV when upping interface for -M<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;   networking/ifplugd.c |      6 +++++-<br>
&gt;&gt; &gt;   1 file changed, 5 insertions(+), 1 deletion(-)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; diff --git a/networking/ifplugd.c b/networking/ifplugd.c<br>
&gt;&gt; &gt; index 28c49e2..67251ae 100644<br>
&gt;&gt; &gt; --- a/networking/ifplugd.c<br>
&gt;&gt; &gt; +++ b/networking/ifplugd.c<br>
&gt;&gt; &gt; @@ -359,7 +359,11 @@ static void up_iface(void)<br>
&gt;&gt; &gt;                          /* Let user know we mess up with interface \
*/<br> &gt;&gt; &gt;                          bb_error_msg(&quot;upping \
interface&quot;);<br> &gt;&gt; &gt;                          if \
(network_ioctl(SIOCSIFFLAGS, &amp;ifrequest, &quot;setting<br> &gt;&gt; &gt; \
interface flags&quot;) &lt; 0)<br> &gt;&gt; &gt; -                                   \
xfunc_die();<br> &gt;&gt; &gt; +                                   if (errno == \
ENODEV) {<br> &gt;&gt; &gt; +                                               \
G.iface_exists = 0;<br> &gt;&gt; &gt; +                                               \
return;<br> &gt;&gt; &gt; +                                   } else<br>
&gt;&gt; &gt; +                                               xfunc_die();<br>
&gt;&gt; &gt;              }<br>
&gt;&gt;<br>
&gt;&gt; This makes sense. But...<br>
&gt;&gt;<br>
&gt;&gt;              set_ifreq_to_ifname(&amp;<wbr>ifrequest);<br>
&gt;&gt;              if (network_ioctl(SIOCGIFFLAGS, &amp;ifrequest, &quot;getting \
interface<br> &gt;&gt; flags&quot;) &lt; 0) {<br>
&gt;&gt;                          G.iface_exists = 0;<br>
&gt;&gt;                          return;<br>
&gt;&gt;              }<br>
&gt;&gt;<br>
&gt;&gt;              if (!(ifrequest.ifr_flags &amp; IFF_UP)) {<br>
&gt;&gt;                          ifrequest.ifr_flags |= IFF_UP;<br>
&gt;&gt;                          /* Let user know we mess up with interface */<br>
&gt;&gt;                          bb_error_msg(&quot;upping interface&quot;);<br>
&gt;&gt;                          if (network_ioctl(SIOCSIFFLAGS, &amp;ifrequest, \
&quot;setting<br> &gt;&gt; interface flags&quot;) &lt; 0) {<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I just wonder, how on Earth SIOCGIFFLAGS just above did _not_ fail?<br>
&gt;&gt; The iface deletion race? Very tight, almost impossible to hit...<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div>



_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic