diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2010-07-07 18:03:15 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-07-07 15:06:55 -0300 |
commit | 403855f939a16c2195532da396f4d1587a833ffb (patch) | |
tree | cd4400b8d6dd59a7d65d8ff7c530fb70244c0232 /src/ipconfig.c | |
parent | fda8614ef6375431082109a587b416faf9e02707 (diff) | |
download | connman-403855f939a16c2195532da396f4d1587a833ffb.tar.gz connman-403855f939a16c2195532da396f4d1587a833ffb.tar.bz2 connman-403855f939a16c2195532da396f4d1587a833ffb.zip |
Start/stop statistics depending on LOWER_UP state
The statistic counters should be updated as soon the
interface enters LOWER_UP state ('cable' connected).
Therefore we do not depend on the state of the
Service object, which fixes also the shortcoming
we have currently with private connections. Those
services do not enter the ONLINE state.
At least for ethernet the lower_up callback
has not been called because the service was
created 'too late'.
Diffstat (limited to 'src/ipconfig.c')
-rw-r--r-- | src/ipconfig.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ipconfig.c b/src/ipconfig.c index 51c4619f..a7d5d325 100644 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -1017,6 +1017,8 @@ int __connman_ipconfig_clear_address(struct connman_ipconfig *ipconfig) int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig) { struct connman_ipdevice *ipdevice; + gboolean up = FALSE, down = FALSE; + gboolean lower_up = FALSE, lower_down = FALSE; DBG("ipconfig %p", ipconfig); @@ -1043,6 +1045,27 @@ int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig) ipconfig_list = g_list_append(ipconfig_list, ipconfig); + if (ipdevice->flags & IFF_UP) + up = TRUE; + else + down = TRUE; + + if ((ipdevice->flags & (IFF_RUNNING | IFF_LOWER_UP)) == + (IFF_RUNNING | IFF_LOWER_UP)) + lower_up = TRUE; + else if ((ipdevice->flags & (IFF_RUNNING | IFF_LOWER_UP)) == 0) + lower_down = TRUE; + + if (up == TRUE && ipconfig->ops->up) + ipconfig->ops->up(ipconfig); + if (lower_up == TRUE && ipconfig->ops->lower_up) + ipconfig->ops->lower_up(ipconfig); + + if (lower_down == TRUE && ipconfig->ops->lower_down) + ipconfig->ops->lower_down(ipconfig); + if (down == TRUE && ipconfig->ops->down) + ipconfig->ops->down(ipconfig); + return 0; } |