inet: Add function to check if IPv6 is supported by kernel
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Mon, 24 Sep 2012 11:44:30 +0000 (14:44 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 25 Sep 2012 13:55:19 +0000 (16:55 +0300)
include/inet.h
src/inet.c

index 8b9b390..6bdcc91 100644 (file)
@@ -82,6 +82,7 @@ int connman_inet_get_dest_addr(int index, char **dest);
 int connman_inet_ipv6_get_dest_addr(int index, char **dest);
 int connman_inet_check_ipaddress(const char *host);
 connman_bool_t connman_inet_check_hostname(const char *ptr, size_t len);
+connman_bool_t connman_inet_is_ipv6_supported();
 
 #ifdef __cplusplus
 }
index 226e505..2dcb63c 100644 (file)
@@ -2473,3 +2473,15 @@ error:
        free(ifr);
        return NULL;
 }
+
+connman_bool_t connman_inet_is_ipv6_supported()
+{
+       int sk;
+
+       sk = socket(PF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0);
+       if (sk < 0)
+               return FALSE;
+
+       close(sk);
+       return TRUE;
+}