Sob's IPv6 Patch

Started by Gregg, April 13, 2011, 01:08:05 AM

Previous topic - Next topic

Gregg

Hi Sob,

I see you sent an email up to the APR list. I had Guenter (before I saw your mail) send up the info from my experience as well, so there's no way now they can say "Well we didn't know" now.  ;)

Sob

I did. Almost three years ago. I can't believe that it was really in 2008. It just got noticed now. Well, could have been sooner, since XP and 2k3 already started to slowly vanish. But better than never.

And since today it's in the trunk and going to release, "unless someone complains soon". Time to open the champagne! :)

Gregg

No one is going to complain. I do not know how XAMPP dealt with it but when they first flipped that bit, there were bug reports. I assume they found our IPv6 builds were we are up front about your patch. It looks like my little note piled on top of your real old email they dug out of the archives might of helped, maybe not, but one less patch for me to carry about.

In time too, your patch just started fuzzing in the past couple week with some of the changes made recently. It still worked, but fuzz tend tp preclude full on failure to patch.

Anyhow, just took a stroll through the svn and there it is, and your name in perpetuity in the svn log/change list  :)

Gregg

Still a bit not all with it this morning. I just re-realized, no more separate ipv6 builds if it does last to the 1.4.3 release, HURRAY!

Sob

You can still have two builds if you want, one with IPv6 enabled and one without it. Most likely unnecessary, but someone who used IPv4-only build so far, might be a little surprised, when it suddenly starts listening on IPv6 too. Not that it could hurt by itself.

Just don't try to enable mapped adddresses, there is still one (different) bug there. Or at least it was about three months ago, when I last checked. And since it's the same one I already encountered back in 2008, I guess it's still there now.
When Apache is configured to listen on any address, it makes it into 0.0.0.0 and ::. With mapped addresses it drops 0.0.0.0, because IPv4 is handled by IPv6 socket. But there's some problem when list of sockets it passed to child process. I don't remember exactly, but it's either that child incorrectly expects one more address (including the dropped 0.0.0.0) or parent passes it when child does not expect it.
I never had enough time to fix it or at least properly understand it, because it's not just simple dealing with network stuff, it requires deeper knowledge about insides of httpd.

Gregg

Wellllllllll, I actually have no clue what your talking about, but I did build an svn pull from last night and tested it on XP this AM. Child processes, as in say php over fcgid? I did not do much testing and I do not use fcgid w/ 2.2 cause I thinks it's dreadfully slow. On Vista, apache seemed to know when it was being hit via IPv6 or IPv4 on Vista at least. The reason I didn't get to involved on the XP testing was a) no ipv6 in hosts file, and b) this damn lappy's Broadcom POS doesn't handle IPv6 (silly).

So in the next couple days I'll put a Win7 eval on the guinea pig which I know can talk across the LAN in IPv6, and who's hosts file has the support as well.  I'll run php through fcgid & give it a whack serving from one of the XP machines.

Oh, did nothing but flipped the APR__HAVE_IPV6 bit to 1, something they have not done yet possiblt cause of W2k but it looks like Jeff had that 1 year past EOL'd version in mind, if I'm understanding his last email correctly.

Built: VC9 SP1 Express SDK on Vista
C:\Apache22\bin>httpd -V
Server version: Apache/2.2.18-r1091978 (Win32)
Server built:   Apr 13 2011 20:08:42
Server's Module Magic Number: 20051115:27
Server loaded:  APR 1.4.3-r1091861, APR-Util 1.4.0-r1091154
Compiled using: APR 1.4.3-r1091861, APR-Util 1.4.0-r1091154
Architecture:   32-bit
Server MPM:     WinNT
APR_HAVE_IPV6     1

                        IPv4    IPv6
Windows Vista SP2    :    OK      OK
Windows XP SP3       :    OK      N/A but doesn't fall down & die
Windows XP SP3 IPv6* :    OK      OK

*IPv6 proto installed



Sob

Child process as when you start one httpd.exe and it starts another, so you see two httpd.exes in task manager.

And mapped addresses, it's when you need to accept both IPv4 and IPv6 connections, then you can do it in two ways. Either bind two separate sockets, one for each protocol. Or use just IPv6 one, set IPV6_V6ONLY option off and it will handle both protocols. The advantage of the latter is that you can write simpler code. Incoming IPv4 connections will then be mapped into ::ffff:0:0/96 space, so the client address will be e.g. ::ffff.82.181.96.10. Not any real benefit for Apache as far as I can tell, because it handles several sockets just fine. But for some applications it can be useful.

Apache has the needed code, it works on Linux, but it seems that no one ever tried it on Windows, because the option to enable it is not present in apr.hw at all, it must be added manually:

#define APR_HAVE_IPV6           1
#define AP_ENABLE_V4_MAPPED     1

But as I said, the result is not good.

Gregg

Well,

#define AP_ENABLE_V4_MAPPED     1
was not a part of your patch, and I have never added it. If it is part of your patch I never noticed.
I know it works well right now on all Windows XP & up, so I do not plan to change the way I build it.
Since I have not noticed them turning on APR_HAVE_IPV6, I just hope I remember to do that when the time comes.

mario

it is kinda intressting. In issue 45321 Jeff wriote that he applied the patch. But he didn't change apr_arch_networkio.h. The patch I got is a bit different to the 45321 attachment

I can't see any define AP_ENABLE_V4_MAPPED     1 in that patches.

Sob

Sorry if I caused any confusion. AP_ENABLE_V4_MAPPED is not supposed to be part of any patch so far. It's something that works on Unix, couldn't work on NT 5.x for technical reasons, but could work on NT 6.x. So I just tried to play with it, because ... well, because I can. :)

And of course apr.h is bad place for AP_ENABLE_V4_MAPPED in any case, because it belongs to httpd, not APR. But it gets included, so for just playing with it it's ok.

Quote from: mario on April 27, 2011, 02:17:54 PMBut he didn't change apr_arch_networkio.h
Only definition of IPV6_V6ONLY was there and it was put into sockopt.c where it's needed.