Subject: | Include an option to disable IPv4-mapped IPv6 support |
I suggest to add a constructor option that allows selection of whether
IPv4-mapped IPv6 address is enabled or not. The attached diff describes
the idea. The patch is tested with Perl 5.8.8 (i386-linux-thread-multi)
+ Linux 2.6.15 on Fedora Core 5. I have no idea whether it will break
other systems though.
Diff taken against Socket6-0.19, IO::Socket::INET6 2.51.
Subject: | Socket6_v6only.diff |
--- Socket6-0.19/Socket6.xs 2005-08-28 00:53:11.000000000 +0800
+++ _Socket6-0.19_v6only/Socket6.xs 2007-03-07 14:43:45.000000000 +0800
@@ -284,6 +284,12 @@
#else
goto not_there;
#endif
+ if (strEQ(name, "IPV6_V6ONLY"))
+#ifdef IPV6_V6ONLY
+ return IPV6_V6ONLY;
+#else
+ goto not_there;
+#endif
break;
case 'N':
if (strEQ(name, "NI_NOFQDN"))
Subject: | IO_Socket_INET6_v6only.diff |
--- /root/.cpan/build/IO-Socket-INET6-2.51/INET6.pm 2004-10-18 21:22:40.000000000 +0800
+++ /usr/lib/perl5/site_perl/5.8.8/IO/Socket/INET6.pm 2007-03-07 14:30:52.000000000 +0800
@@ -184,6 +184,11 @@
$sock->socket($family, $type, $proto) or
return _error($sock, $!, "socket: $!");
+ if ($arg->{v6only}) {
+ setsockopt($sock, IPPROTO_IPV6, IPV6_V6ONLY, 1) or
+ return _error($sock, $!, "socket: $!");
+ }
+
if ($arg->{Reuse} || $arg->{ReuseAddr}) {
$sock->sockopt(SO_REUSEADDR,1) or
return _error($sock, $!, "sockopt: $!");