From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 24 18:38:25 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C827E106566B for ; Wed, 24 Nov 2010 18:38:25 +0000 (UTC) (envelope-from andrey.zonov@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3FD1A8FC1E for ; Wed, 24 Nov 2010 18:38:24 +0000 (UTC) Received: by bwz2 with SMTP id 2so123493bwz.13 for ; Wed, 24 Nov 2010 10:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=eWSSFlkj9ERzqeg5diWtFYSNYNFLzFNqMMH7BI0h6ls=; b=cRi7RLjuvjtTAsGFgiYllKIlzS8uXvPGrZ01vRU0coAV80EXQYas1YB3ptlxxkYq3O ORhQsWvgF832LDshT4iP4YLNYqkpZXDcziR5b/bCA07omTvevUq4sseJTi/dhw88GFxe w4CGPyLTS5RmjL3Bgsv9fGbUX/RYSb91LLw70= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=xrhjOGYIDssNbL8sbtDLcXZ3RWiaAG1jZKpmvhr4uH7elop1njXVy8m9YPc3IkNq4w jt4c6SB5g2CywRg/IeTstTjxYWcJnprxiY9zGHXUx/7ucsuLcCcoqumP800WNxB9MUAi j0PgauSl/kPJk2NjWXIg3GYm+0QJK64TKGG3Y= Received: by 10.204.120.195 with SMTP id e3mr9214198bkr.77.1290622195403; Wed, 24 Nov 2010 10:09:55 -0800 (PST) Received: from [10.254.254.77] (ppp95-165-161-20.pppoe.spdop.ru [95.165.161.20]) by mx.google.com with ESMTPS id g8sm3887470bkg.11.2010.11.24.10.09.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 24 Nov 2010 10:09:53 -0800 (PST) Message-ID: <4CED54EC.2080204@gmail.com> Date: Wed, 24 Nov 2010 21:09:48 +0300 From: Andrey Zonov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: multipart/mixed; boundary="------------080501010907030103040709" Subject: [patch] rresvport_af(3) uses setsockopt(SO_REUSEADDR) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2010 18:38:25 -0000 This is a multi-part message in MIME format. --------------080501010907030103040709 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, I've made the patch for rresvport_af(3) and rcmd_af(3) which makes possible to use more connections for rsh/rshd. I've also reviewed freebsd src tree and I think these changes in libc do not break any existing applications. Can anybody look at the patch? -- Andrey Zonov --------------080501010907030103040709 Content-Type: text/plain; name="rresvport_reuse.patch.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="rresvport_reuse.patch.txt" SW5kZXg6IGxpYmV4ZWMvcnNoZC9yc2hkLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gbGliZXhlYy9y c2hkL3JzaGQuYwkocmV2aXNpb24gMjE1NTA4KQorKysgbGliZXhlYy9yc2hkL3JzaGQuYwko d29ya2luZyBjb3B5KQpAQCAtMjc4LDExICsyNzgsNiBAQAogCSh2b2lkKSBhbGFybSgwKTsK IAlpZiAocG9ydCAhPSAwKSB7CiAJCWludCBscG9ydCA9IElQUE9SVF9SRVNFUlZFRCA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kgewogCQkodm9pZClfY2xvc2Uocyk7Cg== --------------080501010907030103040709--