[git commit] ifplugd: if SIOCSIFFLAGS fails with EADDRNOTAVAIL, don't die

Denys Vlasenko vda.linux at googlemail.com
Thu Mar 29 16:45:11 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=2adaa90534d7c4b189b3ce5d32262cdb7f990dfb
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

When using ifplugd on a RNDIS interface with monitor mode, using
SIOCSIFFLAGS seems to fail with EADDRNOTAVAIL. Treat it the same
as if iface disappeared again.

This has been observed on a Tegra TK1 using Linux 4.14. There seem
to be a race when the kernel is creating the device:
  ifplugd(usb0): started: BusyBox v1.24.1 (2018-03-27 09:47:48 CEST)
  ifplugd(usb0): interface doesn't exist, waiting
  ifplugd(usb0): interface appeared
  ifplugd(usb0): upping interface
  ifplugd(usb0): setting interface flags failed: Cannot assign requested address
  <exit>

With this patch ifplugd is successful in upping the device the second
time around:

  ifplugd(usb0): upping interface
  ifplugd(usb0): using SIOCETHTOOL detection mode
  ifplugd(usb0): interface appeared
  ifplugd(usb0): upping interface
  ifplugd(usb0): setting interface flags failed: Cannot assign requested address
  ifplugd(usb0): interface appeared
  ifplugd(usb0): upping interface
  ifplugd(usb0): using SIOCETHTOOL detection mode
  ifplugd(usb0): link is up
  ifplugd(usb0): executing '/etc/ifplugd/ifplugd.usb.action usb0 up'
  ifplugd up
  ifplugd(usb0): exit code: 0

function                                             old     new   delta
up_iface                                             120     127      +7

Signed-off-by: Stefan Agner <stefan at agner.ch>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/ifplugd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 9bc1a075f..5059eaf73 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -367,7 +367,7 @@ 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) {
-			if (errno != ENODEV)
+			if (errno != ENODEV && errno != EADDRNOTAVAIL)
 				xfunc_die();
 			G.iface_exists = 0;
 			return;


More information about the busybox-cvs mailing list