From 37f818606d6fc7defaa98fb5a611bcdbc798368a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 24 Sep 2012 14:44:30 +0300 Subject: [PATCH] inet: Add function to check if IPv6 is supported by kernel --- include/inet.h | 1 + src/inet.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) 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 } diff --git a/src/inet.c b/src/inet.c index 226e5052..2dcb63cf 100644 --- a/src/inet.c +++ b/src/inet.c @@ -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; +} -- 2.34.1