Re: [2.6.22-rc4] UDP's local port assignment not working correctly.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 7 Jun 2007 20:40:39 +0900
Tetsuo Handa <[email protected]> wrote:

> Hello.
> 
> Same local ports are assigned to multiple sockets.
> The following program should print different local port number.
> 
> ----- Start of program -----
> #include <stdio.h>
> #include <unistd.h>
> #include <sys/socket.h>
> #include <sys/types.h>
> #include <netinet/in.h>
> 
> int main(int argc, char *argv[]) {
> 	struct sockaddr_in addr;
> 	socklen_t size = sizeof(addr);
> 	int server = socket(PF_INET, SOCK_DGRAM, 0), client = socket(PF_INET, SOCK_DGRAM, 0);
> 	addr.sin_family = AF_INET;
> 	addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
> 	addr.sin_port = htons(0);
> 	
> 	printf("Server: Binding UDP 127.0.0.1 0 ... ");
> 	bind(server, (struct sockaddr *) &addr, sizeof(addr));
> 	getsockname(server, (struct sockaddr *) &addr, &size);
> 	printf("bound to port %d\n", ntohs(addr.sin_port));
> 	
> 	printf("Client: Connecting UDP 127.0.0.1 %d ... ", ntohs(addr.sin_port));
> 	connect(client, (struct sockaddr *) &addr, sizeof(addr));
> 	getsockname(client, (struct sockaddr *) &addr, &size);
> 	printf("bound to port %d\n", ntohs(addr.sin_port));
> 	
> 	return 0;
> }
> ----- End of program -----
> 
> I told YOSHIFUJI Hideaki and he answered me that
> this is a regression caused by changing UDP's hash search algorithm to 2-pass.
> 
> Thanks.

CC netdev

Yes, this was discovered two days ago and David reverted four commits.

http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=82c5fde20031375cd93fa5a247cf15603ea1f152

So it should probably be included in Linus tree very very soon.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux