diff mbox

[OpenWrt-Devel,netifd] alias : Fix interface aliased on top of a static interface not getting active

Message ID 1459419510-24449-1-git-send-email-dedeckeh@gmail.com
State Changes Requested
Headers show

Commit Message

Hans Dedecker March 31, 2016, 10:18 a.m. UTC
An interfaces referring to a static interface is not getting active when doing a network
reload or ifup.
The problem is triggered by alias_set_device which is not clearing the pending update
(mostly a null device due to the previous down event) when the same device is set as the
current device via alias_notify_device.
As a result alias_set_device_state when called will overwrite the device with an invalid
pending device meaning the interface will not be set available anymore and thus will
stay down.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
---
 alias.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Jo-Philipp Wich March 31, 2016, 10:30 a.m. UTC | #1
Hi Hans,

pushed into netifd.git, thanks!

~ Jow
diff mbox

Patch

diff --git a/alias.c b/alias.c
index 1f23da0..e4bb700 100644
--- a/alias.c
+++ b/alias.c
@@ -34,8 +34,15 @@  static const struct device_type alias_device_type;
 
 static void alias_set_device(struct alias_device *alias, struct device *dev)
 {
-	if (dev == alias->dep.dev)
+	if (dev == alias->dep.dev) {
+		if (alias->update) {
+			device_remove_user(&alias->new_dep);
+			alias->update = false;
+			if (dev)
+				device_set_present(&alias->dev, true);
+		}
 		return;
+	}
 
 	device_set_present(&alias->dev, false);
 	device_remove_user(&alias->new_dep);