From owner-svn-src-head@FreeBSD.ORG Fri Jan 9 17:02:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 524291065670 for ; Fri, 9 Jan 2009 17:02:13 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mx1.freebsd.org (Postfix) with ESMTP id D71658FC0A for ; Fri, 9 Jan 2009 17:02:12 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-067-249-182.pools.arcor-ip.net [88.67.249.182]) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis) id 0ML25U-1LLKkN1etE-0000MY; Fri, 09 Jan 2009 18:02:11 +0100 Received: (qmail 28558 invoked from network); 9 Jan 2009 17:02:11 -0000 Received: from fbsd8.laiers.local (192.168.4.151) by mx.laiers.local with SMTP; 9 Jan 2009 17:02:11 -0000 From: Max Laier Organization: FreeBSD To: Adrian Chadd Date: Fri, 9 Jan 2009 18:02:09 +0100 User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; i386; ; ) References: <200901091602.n09G2Jj1061164@svn.freebsd.org> In-Reply-To: <200901091602.n09G2Jj1061164@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901091802.10287.max@love2party.net> X-Provags-ID: V01U2FsdGVkX19YzXSsdidjXJrFuhkImU9nGiINzrYsEhslIII aD37XKreo0VCauq5Au2f1hj9agRLbNKmkORXolX6PXhu92lKYE iv8GCwMEveQluTGMt4VRQ== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186955 - in head/sys: conf netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jan 2009 17:02:13 -0000 On Friday 09 January 2009 17:02:19 Adrian Chadd wrote: > Author: adrian > Date: Fri Jan 9 16:02:19 2009 > New Revision: 186955 > URL: http://svn.freebsd.org/changeset/base/186955 > > Log: > Implement a new IP option (not compiled/enabled by default) to allow > applications to specify a non-local IP address when bind()'ing a socket > to a local endpoint. That's a *socket* option ... you had me very worried there for a moment ;) I don't quite see why you'd hide these under a build time option - having the sysctl defaulting to off under CTLFLAG_SECURE seems good enough - if people disagree - make it a boot time tuneable, but I certainly don't see why you should have to rebuild the kernel for a minor thing like this. It certainly isn't performance critical. Some nit picking below ... > Modified: head/sys/netinet/in_pcb.c > @@ -346,7 +347,11 @@ in_pcbbind_setup(struct inpcb *inp, stru > } else if (sin->sin_addr.s_addr != INADDR_ANY) { > sin->sin_port = 0; /* yech... */ > bzero(&sin->sin_zero, sizeof(sin->sin_zero)); > - if (ifa_ifwithaddr((struct sockaddr *)sin) == 0) > + if ( > +#if defined(IP_NONLOCALBIND) > + ((inp->inp_flags & INP_NONLOCALOK) == 0) && > +#endif > + (ifa_ifwithaddr((struct sockaddr *)sin) == 0)) > return (EADDRNOTAVAIL); > } > laddr = sin->sin_addr; This logic is really hard to get a first glance. Esp. the not NON...OK part. Maybe a comment is called for here - or is this just me being confused? > Modified: head/sys/netinet/ip_output.c > @@ -866,6 +873,13 @@ ip_ctloutput(struct socket *so, struct s > return (error); > } > > +#if defined(IP_NONLOCALBIND) > + case IP_NONLOCALOK: > + if (! ip_nonlocalok) { > + error = ENOPROTOOPT; > + break; > + } > +#endif Indentation is off here. And you should add a /* FALLTHROUGH */ comment to make it clear that this is intended. > case IP_TOS: > case IP_TTL: > case IP_MINTTL: -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News