diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-04-03 14:07:24 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-04-12 11:00:42 +0300 |
commit | 709aaebeaca495292306f95d3fb1bc346f331d67 (patch) | |
tree | 476e790b61bf7b7fae4645828029abadcf38d3ff /src/connection.c | |
parent | 4ca9544819ca979354dabdf24f4f4f42c2a416d5 (diff) | |
download | connman-709aaebeaca495292306f95d3fb1bc346f331d67.tar.gz connman-709aaebeaca495292306f95d3fb1bc346f331d67.tar.bz2 connman-709aaebeaca495292306f95d3fb1bc346f331d67.zip |
provider: Disconnect VPN when phy service is disconnected
If the VPN is connected and the underlaying service is
disconnected, then we must also disconnect the VPN if it
is still connected.
Diffstat (limited to 'src/connection.c')
-rw-r--r-- | src/connection.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/connection.c b/src/connection.c index 3747c051..8b1b689d 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1025,6 +1025,28 @@ gboolean __connman_connection_update_gateway(void) return updated; } +int __connman_connection_get_vpn_index(int phy_index) +{ + GHashTableIter iter; + gpointer value, key; + + g_hash_table_iter_init(&iter, gateway_hash); + + while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) { + struct gateway_data *data = value; + + if (data->ipv4_gateway != NULL && + data->ipv4_gateway->vpn_phy_index == phy_index) + return data->index; + + if (data->ipv6_gateway != NULL && + data->ipv6_gateway->vpn_phy_index == phy_index) + return data->index; + } + + return -1; +} + int __connman_connection_init(void) { int err; |