summaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2008-11-29 14:32:14 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2008-11-29 14:32:14 +0000
commit413628a7e3d23a897cd959638d325395e4c9691b (patch)
tree2b8f4835032d12a0e61cc40dad151e279cf7a49f /sys/netinet/udp_usrreq.c
parentf0f4475a13fe3545c10e9b3e8c69679c4abfb1b3 (diff)
Notes
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index de341afcbe0a..2e523091c74a 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -940,9 +940,10 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
* Jail may rewrite the destination address, so let it do
* that before we use it.
*/
- if (jailed(td->td_ucred))
- prison_remote_ip(td->td_ucred, 0,
- &sin->sin_addr.s_addr);
+ if (prison_remote_ip4(td->td_ucred, &sin->sin_addr) != 0) {
+ error = EINVAL;
+ goto release;
+ }
/*
* If a local address or port hasn't yet been selected, or if
@@ -1194,8 +1195,11 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
return (EISCONN);
}
sin = (struct sockaddr_in *)nam;
- if (jailed(td->td_ucred))
- prison_remote_ip(td->td_ucred, 0, &sin->sin_addr.s_addr);
+ if (prison_remote_ip4(td->td_ucred, &sin->sin_addr) != 0) {
+ INP_WUNLOCK(inp);
+ INP_INFO_WUNLOCK(&udbinfo);
+ return (EAFNOSUPPORT);
+ }
error = in_pcbconnect(inp, nam, td->td_ucred);
if (error == 0)
soisconnected(so);