Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171863415
D34557.id103849.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D34557.id103849.diff
View Options
diff --git a/head/sys/kern/uipc_usrreq.c b/head/sys/kern/uipc_usrreq.c
--- a/head/sys/kern/uipc_usrreq.c
+++ b/head/sys/kern/uipc_usrreq.c
@@ -160,6 +160,7 @@
static u_long unpdg_recvspace = 16*1024; /* support 8KB syslog msgs */
static u_long unpsp_sendspace = PIPSIZ; /* really max datagram size */
static u_long unpsp_recvspace = PIPSIZ;
+static int bind_exist_errext = 0;
static SYSCTL_NODE(_net, PF_LOCAL, local, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
"Local domain");
@@ -185,6 +186,9 @@
&unpsp_sendspace, 0, "Default seqpacket send space.");
SYSCTL_ULONG(_net_local_seqpacket, OID_AUTO, recvspace, CTLFLAG_RW,
&unpsp_recvspace, 0, "Default seqpacket receive space.");
+SYSCTL_INT(_net_local, OID_AUTO, bind_exist_errext, CTLFLAG_RW,
+ &bind_exist_errext, 0,
+ "bind() will report EEXIST for non-bound-socket existing files.");
SYSCTL_INT(_net_local, OID_AUTO, inflight, CTLFLAG_RD, &unp_rights, 0,
"File descriptors in flight.");
SYSCTL_INT(_net_local, OID_AUTO, deferred, CTLFLAG_RD,
@@ -648,8 +652,19 @@
else
vput(nd.ni_dvp);
if (vp != NULL) {
+ if (bind_exist_errext == 0)
+ error = EADDRINUSE;
+ else if (vp->v_type != VSOCK)
+ error = EFTYPE;
+ else {
+ vn_lock(vp, LK_SHARED);
+ if (vp->v_unpcb == NULL)
+ error = EEXIST;
+ else
+ error = EADDRINUSE;
+ VOP_UNLOCK(vp, 0);
+ }
vrele(vp);
- error = EADDRINUSE;
goto error;
}
error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 15, 4:20 AM (19 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38940861
Default Alt Text
D34557.id103849.diff (1 KB)
Attached To
Mode
D34557: UNIX-socket bind(): distinguish between alive listening socket and random garbage
Attached
Detach File
Event Timeline
Log In to Comment