From patchwork Tue Oct 28 21:06:33 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yavor Goulishev X-Patchwork-Id: 6161 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 77D1ADDE24 for ; Wed, 29 Oct 2008 08:09:23 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753475AbYJ1VJP (ORCPT ); Tue, 28 Oct 2008 17:09:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753269AbYJ1VJO (ORCPT ); Tue, 28 Oct 2008 17:09:14 -0400 Received: from xsmtp03.mail2web.com ([168.144.250.223]:40323 "EHLO xsmtp03.mail2web.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753459AbYJ1VJN convert rfc822-to-8bit (ORCPT ); Tue, 28 Oct 2008 17:09:13 -0400 Received: from [10.5.31.8] (helo=hub02.ad2.softcom.biz) by xsmtp03.mail2web.com with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.63) (envelope-from ) id 1KuvoM-00075b-T4; Tue, 28 Oct 2008 17:09:12 -0400 Received: from MBX73.ad2.softcom.biz ([10.5.13.34]) by hub02.ad2.softcom.biz ([10.5.31.8]) with mapi; Tue, 28 Oct 2008 17:06:57 -0400 From: Yavor Goulishev To: "netdev@vger.kernel.org" CC: David Miller Date: Tue, 28 Oct 2008 17:06:33 -0400 Thread-Topic: [Patch] Establishing more than 64K outgoing TCP connections Thread-Index: Ack5QQ5NNkSmsakGSZijFU3eJPsXcA== Message-ID: <241CE5A1B2AFFA4987A663380D74C0BB3FD69B08A7@MBX73.ad2.softcom.biz> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Subject: [Patch] Establishing more than 64K outgoing TCP connections Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi guys, I'm sending you a tiny patch for the kernel. The change allowed me to establish more than 64K outgoing TCP connections from a single Linux box. Being able to use multihomed client box to load test a server reduced dramatically the number of physical boxes I needed. The other way to go was virtual machines, but you can't beat the simplicity of the single multihomed client. Also the patch fixes an important symmetry. Using the multihome setup is a simple technique to overcome the 64K limit on the server side. The patch makes it possible on the client side too. The fix is only for TCP but probably the same issue exists for UDP. I didn't had the time to investigate. The patch is against the latest code base 2.6.28-rc2. --Yavor --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index bd1278a..d72fba6 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -109,7 +109,9 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) hashinfo->bhash_size)]; spin_lock(&head->lock); inet_bind_bucket_for_each(tb, node, &head->chain) - if (tb->ib_net == net && tb->port == rover) + if (tb->ib_net == net && + tb->port == rover && + inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) goto next; break; next: