You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by je...@apache.org on 2004/04/03 19:15:52 UTC
cvs commit: apr/network_io/win32 sockopt.c
jerenkrantz 2004/04/03 09:15:52
Modified: . CHANGES
network_io/unix sockopt.c
network_io/win32 sockopt.c
Log:
Even if we do not check the value of APR_IPV6_V6ONLY before setting, we still
must set the option cache if we're setting APR_IPV6_V6ONLY. Otherwise,
later apr_socket_opt_get calls will fail.
This fixes Listen directives on IPv6 machines where IPV6_V6ONLY may be
enabled (i.e. FreeBSD 5.x, OpenBSD, NetBSD) where it would not properly
bind to the IPv4 socket.
Revision Changes Path
1.456 +4 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.455
retrieving revision 1.456
diff -u -u -r1.455 -r1.456
--- CHANGES 27 Mar 2004 13:11:17 -0000 1.455
+++ CHANGES 3 Apr 2004 17:15:52 -0000 1.456
@@ -120,6 +120,10 @@
Changes with APR 0.9.5
+ *) Fix apr_socket_opt_set with APR_IPV6_V6ONLY flag. Fixes httpd
+ Listen IPv6 socket behavior on FreeBSD 5.x, OpenBSD, NetBSD.
+ [Justin Erenkrantz]
+
*) Fix apr_time_exp_get() for dates in 2038.
[Philip Martin <philip codematters.co.uk>]
1.79 +2 -1 apr/network_io/unix/sockopt.c
Index: sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sockopt.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -u -r1.78 -r1.79
--- sockopt.c 27 Feb 2004 15:06:26 -0000 1.78
+++ sockopt.c 3 Apr 2004 17:15:52 -0000 1.79
@@ -283,13 +283,14 @@
case APR_IPV6_V6ONLY:
#if APR_HAVE_IPV6 && defined(IPV6_V6ONLY)
/* we don't know the initial setting of this option,
- * so don't check/set sock->options since that optimization
+ * so don't check sock->options since that optimization
* won't work
*/
if (setsockopt(sock->socketdes, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&on, sizeof(int)) == -1) {
return errno;
}
+ apr_set_option(sock, APR_IPV6_V6ONLY, on);
#else
return APR_ENOTIMPL;
#endif
1.58 +2 -1 apr/network_io/win32/sockopt.c
Index: sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/win32/sockopt.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -u -r1.57 -r1.58
--- sockopt.c 13 Feb 2004 09:38:33 -0000 1.57
+++ sockopt.c 3 Apr 2004 17:15:52 -0000 1.58
@@ -169,13 +169,14 @@
case APR_IPV6_V6ONLY:
#if APR_HAVE_IPV6 && defined(IPV6_V6ONLY)
/* we don't know the initial setting of this option,
- * so don't check/set sock->options since that optimization
+ * so don't check sock->options since that optimization
* won't work
*/
if (setsockopt(sock->socketdes, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&on, sizeof(int)) == -1) {
return apr_get_netos_error();
}
+ apr_set_option(sock, APR_IPV6_V6ONLY, on);
#else
return APR_ENOTIMPL;
#endif
Re: cvs commit: apr/network_io/win32 sockopt.c
Posted by André Malo <nd...@perlig.de>.
* Justin Erenkrantz <ju...@erenkrantz.com> wrote:
> --On Sunday, April 4, 2004 12:08 AM +0200 André Malo <nd...@perlig.de> wrote:
>
> > It doesn't compile.
> >
> > apr_set_option(sock, APR_IPV6_V6ONLY, on);
>
> Would have saved me about 10 minutes of searching if you had said *which*
> branch and OS it didn't compile on. ;-)
ugh, sorry ;-) next time ...
thanks.
nd
Re: cvs commit: apr/network_io/win32 sockopt.c
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Sunday, April 4, 2004 12:08 AM +0200 André Malo <nd...@perlig.de> wrote:
> It doesn't compile.
>
> apr_set_option(sock, APR_IPV6_V6ONLY, on);
Would have saved me about 10 minutes of searching if you had said *which*
branch and OS it didn't compile on. ;-)
Anyhoo, just corrected it on 0.9 branch for Unix. I caught that for Win32,
but apparently not for Unix... *sigh* -- justin
Re: cvs commit: apr/network_io/win32 sockopt.c
Posted by André Malo <nd...@perlig.de>.
* Justin Erenkrantz <ju...@erenkrantz.com> wrote:
> --On Saturday, April 3, 2004 5:15 PM +0000 jerenkrantz@apache.org wrote:
>
> > jerenkrantz 2004/04/03 09:15:52
> >
> > Modified: . CHANGES
> > network_io/unix sockopt.c
> > network_io/win32 sockopt.c
It doesn't compile.
apr_set_option(sock, APR_IPV6_V6ONLY, on);
should probably be
apr_set_option(&sock->netmask, APR_IPV6_V6ONLY, 1);
or something?
nd
Re: cvs commit: apr/network_io/win32 sockopt.c
Posted by Jess Holle <je...@ptc.com>.
While patching sockopt.c, I should point out the need for the following
case in the Win32 sockopt.c's apr_socket_opt_set routine:
case APR_SO_SNDBUF:
if (setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDBUF, (void
*)&on, sizeof(int)) == -1) {
return apr_get_netos_error();
}
break;
Without it one cannot set the send buffer size on Windows, which leads
to a performance penalty on Windows.
--
Jess Holle
Justin Erenkrantz wrote:
> --On Saturday, April 3, 2004 5:15 PM +0000 jerenkrantz@apache.org wrote:
>
>> jerenkrantz 2004/04/03 09:15:52
>>
>> Modified: . CHANGES
>> network_io/unix sockopt.c
>> network_io/win32 sockopt.c
>> Log:
>> Even if we do not check the value of APR_IPV6_V6ONLY before
>> setting, we
>> still must set the option cache if we're setting APR_IPV6_V6ONLY.
>> Otherwise, later apr_socket_opt_get calls will fail.
>>
>> This fixes Listen directives on IPv6 machines where IPV6_V6ONLY may be
>> enabled (i.e. FreeBSD 5.x, OpenBSD, NetBSD) where it would not
>> properly
>> bind to the IPv4 socket.
>
>
> This fixes an issue we saw on hermes.apache.org where the Listen
> directive wasn't binding to the correct interfaces.
>
> I was pretty sure that httpd was doing the right thing here, but it
> was APR that lost the setting of APR_IPV6_V6ONLY - so httpd thought
> that IPV6_V6ONLY was disabled when it really had already been
> enabled. Hence, it collapsed the IPv4 address into the IPv6 socket -
> causing it not to bind to IPv4. -- justin
>
Re: cvs commit: apr/network_io/win32 sockopt.c
Posted by Jess Holle <je...@ptc.com>.
While patching sockopt.c, I should point out the need for the following
case in the Win32 sockopt.c's apr_socket_opt_set routine:
case APR_SO_SNDBUF:
if (setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDBUF, (void
*)&on, sizeof(int)) == -1) {
return apr_get_netos_error();
}
break;
Without it one cannot set the send buffer size on Windows, which leads
to a performance penalty on Windows.
--
Jess Holle
Justin Erenkrantz wrote:
> --On Saturday, April 3, 2004 5:15 PM +0000 jerenkrantz@apache.org wrote:
>
>> jerenkrantz 2004/04/03 09:15:52
>>
>> Modified: . CHANGES
>> network_io/unix sockopt.c
>> network_io/win32 sockopt.c
>> Log:
>> Even if we do not check the value of APR_IPV6_V6ONLY before
>> setting, we
>> still must set the option cache if we're setting APR_IPV6_V6ONLY.
>> Otherwise, later apr_socket_opt_get calls will fail.
>>
>> This fixes Listen directives on IPv6 machines where IPV6_V6ONLY may be
>> enabled (i.e. FreeBSD 5.x, OpenBSD, NetBSD) where it would not
>> properly
>> bind to the IPv4 socket.
>
>
> This fixes an issue we saw on hermes.apache.org where the Listen
> directive wasn't binding to the correct interfaces.
>
> I was pretty sure that httpd was doing the right thing here, but it
> was APR that lost the setting of APR_IPV6_V6ONLY - so httpd thought
> that IPV6_V6ONLY was disabled when it really had already been
> enabled. Hence, it collapsed the IPv4 address into the IPv6 socket -
> causing it not to bind to IPv4. -- justin
>
Re: cvs commit: apr/network_io/win32 sockopt.c
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Saturday, April 3, 2004 5:15 PM +0000 jerenkrantz@apache.org wrote:
> jerenkrantz 2004/04/03 09:15:52
>
> Modified: . CHANGES
> network_io/unix sockopt.c
> network_io/win32 sockopt.c
> Log:
> Even if we do not check the value of APR_IPV6_V6ONLY before setting, we
> still must set the option cache if we're setting APR_IPV6_V6ONLY.
> Otherwise, later apr_socket_opt_get calls will fail.
>
> This fixes Listen directives on IPv6 machines where IPV6_V6ONLY may be
> enabled (i.e. FreeBSD 5.x, OpenBSD, NetBSD) where it would not properly
> bind to the IPv4 socket.
This fixes an issue we saw on hermes.apache.org where the Listen directive
wasn't binding to the correct interfaces.
I was pretty sure that httpd was doing the right thing here, but it was APR
that lost the setting of APR_IPV6_V6ONLY - so httpd thought that IPV6_V6ONLY
was disabled when it really had already been enabled. Hence, it collapsed the
IPv4 address into the IPv6 socket - causing it not to bind to IPv4. -- justin
Re: cvs commit: apr/network_io/win32 sockopt.c
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Saturday, April 3, 2004 5:15 PM +0000 jerenkrantz@apache.org wrote:
> jerenkrantz 2004/04/03 09:15:52
>
> Modified: . CHANGES
> network_io/unix sockopt.c
> network_io/win32 sockopt.c
> Log:
> Even if we do not check the value of APR_IPV6_V6ONLY before setting, we
> still must set the option cache if we're setting APR_IPV6_V6ONLY.
> Otherwise, later apr_socket_opt_get calls will fail.
>
> This fixes Listen directives on IPv6 machines where IPV6_V6ONLY may be
> enabled (i.e. FreeBSD 5.x, OpenBSD, NetBSD) where it would not properly
> bind to the IPv4 socket.
This fixes an issue we saw on hermes.apache.org where the Listen directive
wasn't binding to the correct interfaces.
I was pretty sure that httpd was doing the right thing here, but it was APR
that lost the setting of APR_IPV6_V6ONLY - so httpd thought that IPV6_V6ONLY
was disabled when it really had already been enabled. Hence, it collapsed the
IPv4 address into the IPv6 socket - causing it not to bind to IPv4. -- justin