diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-03-11 14:54:48 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-03-11 14:54:48 +0100 |
commit | 79280d0cf6a006988cb3c6394da44b2aa4c38271 (patch) | |
tree | 44818497aaaf686cade02fb2e4faaf9b0db8643b | |
parent | 0c42162c98c45373b2e9759021361eda40bb5f7e (diff) | |
download | connman-79280d0cf6a006988cb3c6394da44b2aa4c38271.tar.gz connman-79280d0cf6a006988cb3c6394da44b2aa4c38271.tar.bz2 connman-79280d0cf6a006988cb3c6394da44b2aa4c38271.zip |
Use start/stop callbacks if provided
-rw-r--r-- | src/iface-inet.c | 11 | ||||
-rw-r--r-- | src/iface.c | 16 |
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); } |