Handle IPv6 support being missing
authorJamie Cameron <jcameron@webmin.com>
Thu, 25 Nov 2010 05:24:05 +0000 (21:24 -0800)
committerJamie Cameron <jcameron@webmin.com>
Thu, 25 Nov 2010 05:24:05 +0000 (21:24 -0800)
web-lib-funcs.pl

index 9e7aaef..1782fea 100755 (executable)
@@ -2565,6 +2565,11 @@ if ($ip = &to_ipaddress($host)) {
        }
 elsif ($ip = &to_ip6address($host)) {
        # Create IPv6 socket and connection
+       if (!&supports_ipv6()) {
+               $msg = "IPv6 connections are not supported";
+               if ($err) { $$err = $msg; return 0; }
+               else { &error($msg); }
+               }
        if (!socket($fh, Socket6::PF_INET6(), SOCK_STREAM, $proto)) {
                my $msg = "Failed to create IPv6 socket : $!";
                if ($err) { $$err = $msg; return 0; }