Ip_hash load balancer incompatible with IPv6 compat. sockets

I’m using nginx to distribute the load over 3 webservers using the
ip_hash method.
When the listening socket is IPv4/IPv6 compatible ( listen [::]:443; )
only one of the backend servers are used.
With the socket in IPv4 only mode ( listen 0.0.0.0:443; ) the module
correctly distributes the load.
It seems the hash isn’t taking in account the size of the addresses and
because the first 32bits of the struct in this mode doesn’t seem to vary
much the load balacing isn’t working.

Keep up with the good work with this excelent proxy!
Regards.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,221827,221827#msg-221827

Hello!

On Tue, Jan 31, 2012 at 07:46:46AM -0500, pamribeirox wrote:

I’m using nginx to distribute the load over 3 webservers using the
ip_hash method.
When the listening socket is IPv4/IPv6 compatible ( listen [::]:443; )
only one of the backend servers are used.
With the socket in IPv4 only mode ( listen 0.0.0.0:443; ) the module
correctly distributes the load.
It seems the hash isn’t taking in account the size of the addresses and
because the first 32bits of the struct in this mode doesn’t seem to vary
much the load balacing isn’t working.

Yes, ip_hash only works with ipv4 addresses, it’s not currently
able to handle ipv6 addresses (including v4-mapped ones).

Maxim D.