Subject: | [PATCH] CAN_DISABLE_V6ONLY crashes under dragonfly |
Hello,
CAN_DISABLE_V6ONLY crashes with "Cannot setsockopt() - Operation not supported" under DragonFly BSD.
Excerpt from "man ip6" from dragonfly:
Show quoted text
>IPV6_V6ONLY int *
> Get or set whether only IPv6 connections can be made to this
> socket. For wildcard sockets, this can restrict connections to
> IPv6 only. With DragonFly, the socket option cannot be set to 0
> (which will result in returning EOPNOTSUPP).
All tests pass when attached patch is applied.
Subject: | io_socket_ip_dfly.patch |
--- IO-Socket-IP-0.38.orig/lib/IO/Socket/IP.pm 2016-08-02 19:37:26.000000000 +0200
+++ IO-Socket-IP-0.38.new/lib/IO/Socket/IP.pm 2017-01-10 02:13:18.000000000 +0100
@@ -31,7 +31,7 @@
my $AF_INET6 = eval { Socket::AF_INET6() }; # may not be defined
my $AI_ADDRCONFIG = eval { Socket::AI_ADDRCONFIG() } || 0;
use POSIX qw( dup2 );
-use Errno qw( EINVAL EINPROGRESS EISCONN ENOTCONN ETIMEDOUT EWOULDBLOCK );
+use Errno qw( EINVAL EINPROGRESS EISCONN ENOTCONN ETIMEDOUT EWOULDBLOCK EOPNOTSUPP );
use constant HAVE_MSWIN32 => ( $^O eq "MSWin32" );
@@ -154,7 +154,7 @@
if( setsockopt $testsock, IPPROTO_IPV6, IPV6_V6ONLY, 0 ) {
return $can_disable_v6only = 1;
}
- elsif( $! == EINVAL ) {
+ elsif( $! == EINVAL || $! == EOPNOTSUPP ) {
return $can_disable_v6only = 0;
}
else {