Hello,
I think this should be done by autoconf.
And hand added into win32 for MSVC.
Alon.
On Wed, Aug 10, 2011 at 3:55 PM, Heiko Hund <heiko.hund@...> wrote:
> The s6_addr32 member of struct in6_addr is not available when building
> for WIN32. To work around this, a local union is defined that allows
> accessing 32 bit chunks of the IPv6 address passed to add_in6_addr().
>
> Signed-off-by: Heiko Hund <heiko.hund@...>
> ---
> socket.c | 16 +++++++---------
> 1 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/socket.c b/socket.c
> index 6b855c0..887569c 100644
> --- a/socket.c
> +++ b/socket.c
> @@ -2622,13 +2622,6 @@ print_in6_addr (struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
> /* add some offset to an ipv6 address
> * (add in steps of 32 bits, taking overflow into next round)
> */
> -#ifndef s6_addr32
> -# ifdef TARGET_SOLARIS
> -# define s6_addr32 _S6_un._S6_u32
> -# else
> -# define s6_addr32 __u6_addr.__u6_addr32
> -# endif
> -#endif
> #ifndef UINT32_MAX
> # define UINT32_MAX (4294967295U)
> #endif
> @@ -2637,10 +2630,15 @@ struct in6_addr add_in6_addr( struct in6_addr base, uint32_t add )
> int i;
> uint32_t h;
>
> + union {
> + uint8_t *addr;
> + uint32_t *addr32;
> + } in6 = { .addr = base.s6_addr };
> +
> for( i=3; i>=0 && add > 0 ; i-- )
> {
> - h = ntohl( base.s6_addr32[i] );
> - base.s6_addr32[i] = htonl( (h+add) & UINT32_MAX );
> + h = ntohl( in6.addr32[i] );
> + in6.addr32[i] = htonl( (h+add) & UINT32_MAX );
> /* 32-bit overrun?
> * caveat: can't do "h+add > UINT32_MAX" with 32bit math!
> */
> --
> 1.7.5.4
>
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at: http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@...
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>
|