summaryrefslogtreecommitdiff
path: root/src/basic/socket-util.c
diff options
context:
space:
mode:
authorJorgen Schaefer <contact@jorgenschaefer.de>2015-12-10 13:24:45 +0100
committerJorgen Schaefer <contact@jorgenschaefer.de>2015-12-10 13:47:19 +0100
commit7377964d4c9791a29e3679bafc65f6bfbb0bb019 (patch)
tree97b24b86ea192c760969c6fb6a4db9bd429a5f2e /src/basic/socket-util.c
parent312501458d119704e27e14ef59a18f612757421c (diff)
Use /proc/net/sockstat6 to detect IPv6 support
The file /sys/module/ipv6 does not exist in all container implementations (e.g. Virtuozzo). Using /proc/net/sockstat6 detects IPv6 support reliably in these environments, too. This file does not exist when the kernel is not compiled with IPv6 support, or if IPv6 support is disabled, so simply checking for existence should be a suitable check. Fixes #2059
Diffstat (limited to 'src/basic/socket-util.c')
-rw-r--r--src/basic/socket-util.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index 79901a6a06..be144e157d 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -440,17 +440,10 @@ const char* socket_address_get_path(const SocketAddress *a) {
}
bool socket_ipv6_is_supported(void) {
- _cleanup_free_ char *l = NULL;
-
- if (access("/sys/module/ipv6", F_OK) != 0)
+ if (access("/proc/net/sockstat6", F_OK) != 0)
return false;
- /* If we can't check "disable" parameter, assume enabled */
- if (read_one_line_file("/sys/module/ipv6/parameters/disable", &l) < 0)
- return true;
-
- /* If module was loaded with disable=1 no IPv6 available */
- return l[0] == '0';
+ return true;
}
bool socket_address_matches_fd(const SocketAddress *a, int fd) {