summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/iface-inet.c11
-rw-r--r--src/iface.c16
2 files changed, 14 insertions, 13 deletions
diff --git a/src/iface-inet.c b/src/iface-inet.c
index a0915af4..927f5689 100644
--- a/src/iface-inet.c
+++ b/src/iface-inet.c
@@ -145,10 +145,7 @@ int __connman_iface_up(struct connman_iface *iface)
goto done;
}
- if (iface->driver->start)
- err = iface->driver->start(iface);
- else
- err = 0;
+ err = 0;
done:
close(sk);
@@ -163,12 +160,6 @@ int __connman_iface_down(struct connman_iface *iface)
DBG("iface %p", iface);
- if (iface->driver->stop) {
- err = iface->driver->stop(iface);
- if (err < 0)
- return err;
- }
-
sk = socket(PF_INET, SOCK_DGRAM, 0);
if (sk < 0)
return -errno;
diff --git a/src/iface.c b/src/iface.c
index b91c1973..65e4cdd0 100644
--- a/src/iface.c
+++ b/src/iface.c
@@ -215,14 +215,20 @@ static void switch_policy(struct connman_iface *iface)
iface->state = CONNMAN_IFACE_STATE_SHUTDOWN;
state_changed(iface);
connman_iface_clear_ipv4(iface);
- __connman_iface_down(iface);
+ if (iface->driver->stop)
+ iface->driver->stop(iface);
+ else
+ __connman_iface_down(iface);
break;
case CONNMAN_IFACE_POLICY_IGNORE:
break;
case CONNMAN_IFACE_POLICY_AUTO:
- __connman_iface_up(iface);
+ if (iface->driver->start)
+ iface->driver->start(iface);
+ else
+ __connman_iface_up(iface);
state_changed(iface);
break;
@@ -252,9 +258,13 @@ void connman_iface_indicate_disabled(struct connman_iface *iface)
if (iface->policy == CONNMAN_IFACE_POLICY_AUTO) {
iface->state = CONNMAN_IFACE_STATE_ENABLED;
- __connman_iface_up(iface);
+ if (iface->driver->start)
+ iface->driver->start(iface);
+ else
+ __connman_iface_up(iface);
} else
iface->state = CONNMAN_IFACE_STATE_SHUTDOWN;
+
state_changed(iface);
}