On 09/12/16 09:15, Gert Doering wrote: > Hi, > > On Fri, Dec 09, 2016 at 03:52:32AM +0100, David Sommerseth wrote: >> - Instead of checking the complete in_addr_t (which lacked proper htonl()), >> just do a simple peek at the last byte which contains the first octet >> of an IP address or subnet mask. > > Have you *tested* this on a non-intel platform? > > I know that I said on IRC that we might do it that way, but looking > at stuff like print_in_addr_t() I'm not sure our usage of in_addr_t is > consistant with "normal usage of it" (namely, always in network byte > order).
I don't have access to any big-endian machines. I might still have access to a virtual POWER8 machine, but that is configured in little-endian mode - so no difference from the Intel platform. After I sent this patch, I started to ponder on if there were any performance reasons why to change the in_addr_t check. And I've come to the conclusion I doubt it makes much of a difference. First of all, an IPv4 address is 32-bits, which is the smallest CPU variants we do support. So 0xff000000 or 0xff will just be copied into a 32-bit register anyway. Secondly, checking for just 0xff will remove one AND operation on the CPU and the mov(e) operation will just be slightly different as it only loads 8 bits from a memory region vs 32 bits. So we might end up with or without saving just a couple of CPU cycles. And when considering that this is code paths which is not called very often, it starts to smell very much like pointless micro-optimization. I suggest we leave the in_addr_t parsing unchanged, and fix the message handling to differentiate between --ifconfig and --ifconfig-push. And after 2.4.0, we can look at the in_addr_t tackling to see if it behaves correctly on both big- and little-endian. If it doesn't behave well then we'll fix it. Thoughts? -- kind regards, David Sommerseth OpenVPN Technologies, Inc
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/xeonphi
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel