summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-02-22 07:50:02 +0000
committerglebius <glebius@FreeBSD.org>2005-02-22 07:50:02 +0000
commit38f30cf325c63613bb561ad3833e16b1d3298921 (patch)
treed99f4dbb67ca7cc3dd0821dbff1ed73dad3309c9 /sys/netinet
parent5f0d747b305c9be3747f2e80eeeeff8e3a791725 (diff)
downloadFreeBSD-src-38f30cf325c63613bb561ad3833e16b1d3298921.zip
FreeBSD-src-38f30cf325c63613bb561ad3833e16b1d3298921.tar.gz
In in_pcbconnect_setup() jailed sockets are treated specially: if local
address is not supplied, then jail IP is choosed and in_pcbbind() is called. Since udp_output() does not save local addr after call to in_pcbconnect_setup(), in_pcbbind() is called for each packet, and this is incorrect. So, we shall treat jailed sockets specially in udp_output(), we will save their local address. This fixes a long standing bug with broken sendto() system call in jails. PR: kern/26506 Reviewed by: rwatson MFC after: 2 weeks
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/udp_usrreq.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 29bfaf2..d96344b 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -804,6 +804,11 @@ udp_output(inp, m, addr, control, td)
/* Commit the local port if newly assigned. */
if (inp->inp_laddr.s_addr == INADDR_ANY &&
inp->inp_lport == 0) {
+ /*
+ * Remember addr if jailed, to prevent rebinding.
+ */
+ if (jailed(td->td_ucred))
+ inp->inp_laddr = laddr;
inp->inp_lport = lport;
if (in_pcbinshash(inp) != 0) {
inp->inp_lport = 0;
OpenPOWER on IntegriCloud