[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200706072040.BEC00116.MQFFtSOVOHFOLJ@I-love.SAKURA.ne.jp>
Date: Thu, 7 Jun 2007 20:40:39 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: linux-kernel@...r.kernel.org
Subject: [2.6.22-rc4] UDP's local port assignment not working correctly.
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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists