From owner-svn-src-head@FreeBSD.ORG Thu Feb 5 14:25:54 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 4F0061065679; Thu, 5 Feb 2009 14:25:54 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D0838FC12; Thu, 5 Feb 2009 14:25:54 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15EPsBE029370; Thu, 5 Feb 2009 14:25:54 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15EPsrY029368; Thu, 5 Feb 2009 14:25:54 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200902051425.n15EPsrY029368@svn.freebsd.org> From: Jamie Gritton Date: Thu, 5 Feb 2009 14:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188148 - in head/sys: netinet netinet6 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: Thu, 05 Feb 2009 14:25:54 -0000 Author: jamie Date: Thu Feb 5 14:25:53 2009 New Revision: 188148 URL: http://svn.freebsd.org/changeset/base/188148 Log: Remove redundant calls of prison_local_ip4 in in_pcbbind_setup, and of prison_local_ip6 in in6_pcbbind. Approved by: bz (mentor) Modified: head/sys/netinet/in_pcb.c head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Feb 5 14:21:09 2009 (r188147) +++ head/sys/netinet/in_pcb.c Thu Feb 5 14:25:53 2009 (r188148) @@ -313,7 +313,10 @@ in_pcbbind_setup(struct inpcb *inp, stru return (EINVAL); if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0) wild = INPLOOKUP_WILDCARD; - if (nam) { + if (nam == NULL) { + if ((error = prison_local_ip4(cred, &laddr)) != 0) + return (error); + } else { sin = (struct sockaddr_in *)nam; if (nam->sa_len != sizeof (*sin)) return (EINVAL); @@ -392,9 +395,6 @@ in_pcbbind_setup(struct inpcb *inp, stru t->inp_cred->cr_uid)) return (EADDRINUSE); } - error = prison_local_ip4(cred, &sin->sin_addr); - if (error) - return (error); t = in_pcblookup_local(pcbinfo, sin->sin_addr, lport, wild, cred); if (t && (t->inp_vflag & INP_TIMEWAIT)) { @@ -428,10 +428,6 @@ in_pcbbind_setup(struct inpcb *inp, stru u_short first, last, aux; int count; - error = prison_local_ip4(cred, &laddr); - if (error) - return (error); - if (inp->inp_flags & INP_HIGHPORT) { first = V_ipport_hifirstauto; /* sysctl */ last = V_ipport_hilastauto; @@ -496,9 +492,6 @@ in_pcbbind_setup(struct inpcb *inp, stru } while (in_pcblookup_local(pcbinfo, laddr, lport, wild, cred)); } - error = prison_local_ip4(cred, &laddr); - if (error) - return (error); *laddrp = laddr.s_addr; *lportp = lport; return (0); Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Thu Feb 5 14:21:09 2009 (r188147) +++ head/sys/netinet6/in6_pcb.c Thu Feb 5 14:25:53 2009 (r188148) @@ -130,7 +130,11 @@ in6_pcbbind(register struct inpcb *inp, return (EINVAL); if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0) wild = INPLOOKUP_WILDCARD; - if (nam) { + if (nam == NULL) { + if ((error = prison_local_ip6(cred, &inp->in6p_laddr, + ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) + return (error); + } else { sin6 = (struct sockaddr_in6 *)nam; if (nam->sa_len != sizeof(*sin6)) return (EINVAL); @@ -221,9 +225,6 @@ in6_pcbbind(register struct inpcb *inp, return (EADDRINUSE); } } - if ((error = prison_local_ip6(cred, &sin6->sin6_addr, - ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) - return (error); t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr, lport, wild, cred); if (t && (reuseport & ((t->inp_vflag & INP_TIMEWAIT) ? @@ -256,9 +257,6 @@ in6_pcbbind(register struct inpcb *inp, } inp->in6p_laddr = sin6->sin6_addr; } - if ((error = prison_local_ip6(cred, &inp->in6p_laddr, - ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) - return (error); if (lport == 0) { if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0) return (error);