From: Jukka Rissanen Date: Fri, 25 Mar 2011 13:03:18 +0000 (+0200) Subject: 6to4: Check if the 6to4 tunnel is active or not. X-Git-Tag: 2.0_alpha~1633 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7370e6d24a9a15053045026755a51965a804599a;p=framework%2Fconnectivity%2Fconnman.git 6to4: Check if the 6to4 tunnel is active or not. --- diff --git a/src/6to4.c b/src/6to4.c index e6815a0..3877bfb 100644 --- a/src/6to4.c +++ b/src/6to4.c @@ -540,3 +540,23 @@ void __connman_6to4_remove(struct connman_ipconfig *ip4config) if (tunnel_created) tunnel_destroy(); } + +int __connman_6to4_check(struct connman_ipconfig *ip4config) +{ + const char *address; + + if (ip4config == NULL || tunnel_created == 0 || + tunnel_pending == 1) + return -1; + + DBG("tunnel ip address %s", tunnel_ip_address); + + address = __connman_ipconfig_get_local(ip4config); + if (address == NULL) + return -1; + + if (g_strcmp0(address, tunnel_ip_address) == 0) + return 1; + + return 0; +} diff --git a/src/connman.h b/src/connman.h index 1ca73ed..d466b21 100644 --- a/src/connman.h +++ b/src/connman.h @@ -648,3 +648,4 @@ void __connman_dnsproxy_flush(void); int __connman_6to4_probe(struct connman_service *service); void __connman_6to4_remove(struct connman_ipconfig *ipconfig); +int __connman_6to4_check(struct connman_ipconfig *ipconfig);