[PATCH] ifplugd: Allow ENODEV when upping interface for -M
Denys Vlasenko
vda.linux at googlemail.com
Tue Aug 16 23:52:25 UTC 2016
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