svn commit: r220489 - stable/8/sys/netinet6
Bjoern A. Zeeb
bz at FreeBSD.org
Sat Apr 9 12:35:08 UTC 2011
Author: bz
Date: Sat Apr 9 12:35:08 2011
New Revision: 220489
URL: http://svn.freebsd.org/changeset/base/220489
Log:
MFC r219570:
Push a possible "unbind" in some situation from in6_pcbsetport() to
callers. This also fixes a problem when the prison call could set
the inp->in6p_laddr (laddr) and a following priv_check_cred() call
would return an error and will allow us to merge the IPv4 and IPv6
implementation.
Modified:
stable/8/sys/netinet6/in6_pcb.c
stable/8/sys/netinet6/in6_src.c
stable/8/sys/netinet6/udp6_usrreq.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/netinet6/in6_pcb.c
==============================================================================
--- stable/8/sys/netinet6/in6_pcb.c Sat Apr 9 12:15:40 2011 (r220488)
+++ stable/8/sys/netinet6/in6_pcb.c Sat Apr 9 12:35:08 2011 (r220489)
@@ -258,8 +258,11 @@ in6_pcbbind(register struct inpcb *inp,
inp->in6p_laddr = sin6->sin6_addr;
}
if (lport == 0) {
- if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0)
+ if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0) {
+ /* Undo an address bind that may have occurred. */
+ inp->in6p_laddr = in6addr_any;
return (error);
+ }
} else {
inp->inp_lport = lport;
if (in_pcbinshash(inp) != 0) {
Modified: stable/8/sys/netinet6/in6_src.c
==============================================================================
--- stable/8/sys/netinet6/in6_src.c Sat Apr 9 12:15:40 2011 (r220488)
+++ stable/8/sys/netinet6/in6_src.c Sat Apr 9 12:35:08 2011 (r220489)
@@ -925,11 +925,8 @@ in6_pcbsetport(struct in6_addr *laddr, s
count = last - first;
do {
- if (count-- < 0) { /* completely used? */
- /* Undo an address bind that may have occurred. */
- inp->in6p_laddr = in6addr_any;
+ if (count-- < 0) /* completely used? */
return (EADDRNOTAVAIL);
- }
++*lastport;
if (*lastport < first || *lastport > last)
*lastport = first;
Modified: stable/8/sys/netinet6/udp6_usrreq.c
==============================================================================
--- stable/8/sys/netinet6/udp6_usrreq.c Sat Apr 9 12:15:40 2011 (r220488)
+++ stable/8/sys/netinet6/udp6_usrreq.c Sat Apr 9 12:35:08 2011 (r220489)
@@ -656,8 +656,11 @@ udp6_output(struct inpcb *inp, struct mb
goto release;
}
if (inp->inp_lport == 0 &&
- (error = in6_pcbsetport(laddr, inp, td->td_ucred)) != 0)
+ (error = in6_pcbsetport(laddr, inp, td->td_ucred)) != 0) {
+ /* Undo an address bind that may have occurred. */
+ inp->in6p_laddr = in6addr_any;
goto release;
+ }
} else {
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
error = ENOTCONN;
More information about the svn-src-stable-8
mailing list