From patchwork Wed Oct 1 14:24:31 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: KOVACS Krisztian X-Patchwork-Id: 2261 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 3FDE0DDDFA for ; Thu, 2 Oct 2008 01:25:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752759AbYJAPZc (ORCPT ); Wed, 1 Oct 2008 11:25:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753166AbYJAPZa (ORCPT ); Wed, 1 Oct 2008 11:25:30 -0400 Received: from balu.sch.bme.hu ([152.66.208.40]:53158 "EHLO balu.sch.bme.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752759AbYJAPZ1 (ORCPT ); Wed, 1 Oct 2008 11:25:27 -0400 X-Greylist: delayed 3601 seconds by postgrey-1.27 at vger.kernel.org; Wed, 01 Oct 2008 11:25:23 EDT Received: from [192.168.1.105] ([194.2.45.170]) by balu.sch.bme.hu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0K8200N5BDDA4570@balu.sch.bme.hu>; Wed, 01 Oct 2008 16:24:47 +0200 (CEST) Date: Wed, 01 Oct 2008 16:24:31 +0200 From: KOVACS Krisztian Subject: [net-next PATCH 03/16] Allow binding to non-local addresses if IP_TRANSPARENT is set In-reply-to: <20081001142431.4893.48078.stgit@este> To: David Miller Cc: Patrick McHardy , netdev@vger.kernel.org, netfilter-devel@vger.kernel.org Message-id: <20081001142431.4893.89758.stgit@este> MIME-version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT References: <20081001142431.4893.48078.stgit@este> User-Agent: StGIT/0.13 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Setting IP_TRANSPARENT is not really useful without allowing non-local binds for the socket. To make user-space code simpler we allow these binds even if IP_TRANSPARENT is set but IP_FREEBIND is not. Signed-off-by: Tóth László Attila --- net/ipv4/af_inet.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- 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/af_inet.c b/net/ipv4/af_inet.c index 8a3ac1f..1fbff5f 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -469,7 +469,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) */ err = -EADDRNOTAVAIL; if (!sysctl_ip_nonlocal_bind && - !inet->freebind && + !(inet->freebind || inet->transparent) && addr->sin_addr.s_addr != htonl(INADDR_ANY) && chk_addr_ret != RTN_LOCAL && chk_addr_ret != RTN_MULTICAST &&