diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-09-24 14:44:30 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-09-25 16:55:19 +0300 |
commit | 37f818606d6fc7defaa98fb5a611bcdbc798368a (patch) | |
tree | e5dc871ead1bdd12927c01924fcd0bd6ebc91abd | |
parent | d2da5cb4ba0f91e6e4cf7814c7ffaa420bef2675 (diff) | |
download | connman-37f818606d6fc7defaa98fb5a611bcdbc798368a.tar.gz connman-37f818606d6fc7defaa98fb5a611bcdbc798368a.tar.bz2 connman-37f818606d6fc7defaa98fb5a611bcdbc798368a.zip |
inet: Add function to check if IPv6 is supported by kernel
-rw-r--r-- | include/inet.h | 1 | ||||
-rw-r--r-- | src/inet.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/inet.h b/include/inet.h index 8b9b390a..6bdcc91d 100644 --- a/include/inet.h +++ b/include/inet.h @@ -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 } @@ -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; +} |