summaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2000-09-17 11:34:33 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2000-09-17 11:34:33 +0000
commite2cabba9d7e65e74d19a7f500d717b5967fa2709 (patch)
tree858aa06600a0fc7688e1c2d050c255003c5604d6 /sys/netinet/udp_usrreq.c
parent68560dc2ad955a5977401208b8622a2e60adb0da (diff)
Notes
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 07b1166bba33..6a868796cd3d 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -827,10 +827,15 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
return EINVAL;
if (inp->inp_faddr.s_addr != INADDR_ANY)
return EISCONN;
+ error = 0;
s = splnet();
- sin = (struct sockaddr_in *)nam;
- prison_remote_ip(p, 0, &sin->sin_addr.s_addr);
- error = in_pcbconnect(inp, nam, p);
+ if (inp->inp_laddr.s_addr == INADDR_ANY && p->p_prison != NULL)
+ error = in_pcbbind(inp, NULL, p);
+ if (error == 0) {
+ sin = (struct sockaddr_in *)nam;
+ prison_remote_ip(p, 0, &sin->sin_addr.s_addr);
+ error = in_pcbconnect(inp, nam, p);
+ }
splx(s);
if (error == 0)
soisconnected(so);