X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fconnection.c;h=33f61031a58a3a859fed5d597d3ec023f88cefcd;hb=bf0e619ef451bde3568c1af509ccb12cbda2ff93;hp=6036db312353e42d8869b3bbc6b4cf5c6d8fdf3e;hpb=2985b9822ac3f5acfef2933cbda98c1285e11af4;p=platform%2Fupstream%2Fconnman.git diff --git a/src/connection.c b/src/connection.c index 6036db3..33f6103 100755 --- a/src/connection.c +++ b/src/connection.c @@ -1136,6 +1136,29 @@ int __connman_connection_get_vpn_index(int phy_index) return -1; } +int __connman_connection_get_vpn_phy_index(int vpn_index) +{ + GHashTableIter iter; + gpointer value, key; + + g_hash_table_iter_init(&iter, gateway_hash); + + while (g_hash_table_iter_next(&iter, &key, &value)) { + struct gateway_data *data = value; + + if (data->index != vpn_index) + continue; + + if (data->ipv4_gateway) + return data->ipv4_gateway->vpn_phy_index; + + if (data->ipv6_gateway) + return data->ipv6_gateway->vpn_phy_index; + } + + return -1; +} + int __connman_connection_init(void) { int err;