diff options
-rw-r--r-- | device.c | 1 | ||||
-rw-r--r-- | system-dummy.c | 5 | ||||
-rw-r--r-- | system-linux.c | 5 | ||||
-rw-r--r-- | system.h | 1 |
4 files changed, 8 insertions, 4 deletions
@@ -206,6 +206,7 @@ int device_init(struct device *dev, const struct device_type *type, const char * if (ret < 0) return ret; + system_if_clear_state(dev); device_check_state(dev); return 0; diff --git a/system-dummy.c b/system-dummy.c index 9a646dc..00a9b2a 100644 --- a/system-dummy.c +++ b/system-dummy.c @@ -64,6 +64,11 @@ int system_if_down(struct device *dev) return 0; } +void system_if_clear_state(struct device *dev) +{ + return 0; +} + int system_if_check(struct device *dev) { dev->ifindex = 0; diff --git a/system-linux.c b/system-linux.c index b823099..9f1aa9e 100644 --- a/system-linux.c +++ b/system-linux.c @@ -202,7 +202,7 @@ static int system_if_flags(const char *ifname, unsigned add, unsigned rem) /* * Clear bridge (membership) state and bring down device */ -static void system_if_clear_state(struct device *dev) +void system_if_clear_state(struct device *dev) { char buf[256]; char *bridge; @@ -236,7 +236,6 @@ int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg) { unsigned long args[4] = {}; - system_if_clear_state(bridge); if (ioctl(sock_ioctl, SIOCBRADDBR, bridge->ifname) < 0) return -1; @@ -291,7 +290,6 @@ static int system_vlan(struct device *dev, int id) int system_vlan_add(struct device *dev, int id) { - system_if_clear_state(dev); return system_vlan(dev, id); } @@ -313,7 +311,6 @@ int system_if_down(struct device *dev) int system_if_check(struct device *dev) { - system_if_clear_state(dev); device_set_present(dev, (system_if_resolve(dev) >= 0)); return 0; } @@ -32,6 +32,7 @@ int system_bridge_delif(struct device *bridge, struct device *dev); int system_vlan_add(struct device *dev, int id); int system_vlan_del(struct device *dev); +void system_if_clear_state(struct device *dev); int system_if_up(struct device *dev); int system_if_down(struct device *dev); int system_if_check(struct device *dev); |