diff options
author | bz <bz@FreeBSD.org> | 2011-03-12 16:45:15 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2011-03-12 16:45:15 +0000 |
commit | 5d37412b23a8bef61f5bd22635be9554076ef5ed (patch) | |
tree | 369bf9f83a69159dcfa0346685c2b6c89c1b49e3 /sys/netinet6/udp6_usrreq.c | |
parent | e3ccdf9a91cfbd4bd32ac050106dbaa9e22c3fe3 (diff) | |
download | FreeBSD-src-5d37412b23a8bef61f5bd22635be9554076ef5ed.zip FreeBSD-src-5d37412b23a8bef61f5bd22635be9554076ef5ed.tar.gz |
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.
MFC after: 2 weeks
Diffstat (limited to 'sys/netinet6/udp6_usrreq.c')
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 65e6f56..422a9c9 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -656,8 +656,11 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6, 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; |