6to4: Check if the 6to4 tunnel is active or not.
authorJukka Rissanen <jukka.rissanen@nokia.com>
Fri, 25 Mar 2011 13:03:18 +0000 (15:03 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 25 Mar 2011 13:46:15 +0000 (14:46 +0100)
src/6to4.c
src/connman.h

index e6815a0e3d39a6efac54eab518ff0e39211f25a7..3877bfbdb51af046e628bbe24e3db075df09c6d2 100644 (file)
@@ -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;
+}
index 1ca73ed04e9c5afbae0f40415b4019530a193943..d466b2160934389e0f2d1e3aff62007e6f31bf3e 100644 (file)
@@ -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);