> Hi, > > attached you'll find another patch that is needed to make OpenVPN compile > on Windows. After quite some consideration I have decided to change > the implementation for all platforms, as doing this with #ifdef WIN32 > would be messy at best. > > What the function in question does is "add a 32 bit offset to an IPv6 > address" - needed for server IP address calculation and for client pool > assignment. The old implementation did so in rounds of 32 bit, but the > windows declaration of "struct in6_addr" has no 32bit-accessor in the > underlying union... windows has 8 and 16 bit, solaris has 8 and 32 bit, > etc., so the only thing available everywhere is "8 bit". > > The addition stuff is a bit tricky as you need to be able to handle > overflows (what's 0x2 + 0xffffffff in 32bit-math?) - but I've actually > tested this for the relevant overflow candidates on Linux/i386 and > NetBSD/Sparc64 (different word size, different endianness), and also ran > random additions on 3 different implementations and compared the results > (same!). So I'm sure it works :-) > > The new function takes about 1.5-1.8x more time, that is, 70usec vs. 40usec > on my Atom 330 - and it's only called once per client connect on the > server. I'm willing to accept the slowness here to make the code easier > to read, and more portable. > > Samuli has confirmed that it fixes this particular compilation problem > on Windows :-) > > gert > As far Visual Studio 2008 compatibility is concerned, I give this patch an ACK. Also, the approach chosen here sounds reasonable.
-- Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock