From: Herbert Poetzl (herbert_at_13thfloor.at)
Date: Mon 30 Aug 2004 - 04:27:26 BST
On Sun, Aug 29, 2004 at 12:57:50AM +0200, Bjoern Steinbrink wrote:
> Hello,
just a short update for all wondering how to fix
this and what about the 1.9.2 release ...
> inside an vserver you can't bind to the same port multiple ip addresses.
> For example, if the vserver has addresses 10.0.0.1 and 10.0.0.2 you
> cannot bind to 10.0.0.1:80 and 10.0.0.2:80. It works if you use
> 0.0.0.0:80 but in cases where for example only 2 of 3 addresses should
> be used this is not an option.
> The problem is that the check within the kernel does always compare all
> addresses available in a context to the one that is requested to be
> bound, even if the socket in question only binds to a single address.
> The patch below applies to 1.9.2.20 and fixes this.
>
> Thanks to ntrs for reporting this and helping to test various things.
thanks to Bobi and Bjoern for tracking this down
and providing valuable information and test scripts
to verify ...
the latest patch to cleanup the networking legacy
code (which should fix this issue) can be found at
http://vserver.13thfloor.at/Experimental/delta-vs1.9.2.x7.diff
please, if you encounter those or similar issues,
give it a try and let me know if it works for you.
a new devel release will be done soon, including
those and other changes/improvements ...
TIA,
Herbert
>
> Bjoern
>
> diff -NurpP --minimal linux-2.6.8.1-vs1.9.2.20/net/ipv4/tcp_ipv4.c
> linux-2.6.8.1
> -vs1.9.2.20-multi-bind-fix/net/ipv4/tcp_ipv4.c
> --- linux-2.6.8.1-vs1.9.2.20/net/ipv4/tcp_ipv4.c 2004-08-22
> 00:39:08.0000
> 00000 +0200
> +++ linux-2.6.8.1-vs1.9.2.20-multi-bind-fix/net/ipv4/tcp_ipv4.c
> 2004-08-29 00:20
> :23.000000000 +0200
> @@ -193,12 +193,17 @@ static inline int tcp_in_list(struct soc
> (sk->sk_socket?sk->sk_socket->flags:0));
>
> if (nxi) {
> - int n = nxi->nbipv4;
> - int i;
> + /* Socket is bound to a single address */
> + if (tcp_v4_rcv_saddr(sk)) {
> + return (tcp_v4_rcv_saddr(sk) == addr);
> + } else {
> + int n = nxi->nbipv4;
> + int i;
>
> - for (i=0; i<n; i++)
> - if (nxi->ipv4[i] == addr)
> - return 1;
> + for (i=0; i<n; i++)
> + if (nxi->ipv4[i] == addr)
> + return 1;
> + }
> }
> else if (!tcp_v4_rcv_saddr(sk) || tcp_v4_rcv_saddr(sk) == addr)
> return 1;
>
>
> _______________________________________________
> Vserver mailing list
> Vserver_at_list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver
_______________________________________________
Vserver mailing list
Vserver_at_list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver