FreeBSD Bugzilla – Attachment 232078 Details for
Bug 262172
UNIX Domain bind() - distinguish between random garbage and alive listening socket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for 11.4
11.4-bind-exist.patch (text/plain), 1.65 KB, created by
firk
on 2022-02-24 16:47:37 UTC
(
hide
)
Description:
patch for 11.4
Filename:
MIME Type:
Creator:
firk
Created:
2022-02-24 16:47:37 UTC
Size:
1.65 KB
patch
obsolete
>diff -ur 11.4-releng/sys/kern/uipc_usrreq.c 11.4-my/sys/kern/uipc_usrreq.c >--- 11.4-releng/sys/kern/uipc_usrreq.c 2020-08-17 19:33:10.000000000 +0300 >+++ 11.4-my/sys/kern/uipc_usrreq.c 2022-02-24 07:59:54.317557000 +0300 >@@ -160,6 +160,7 @@ > static u_long unpdg_recvspace = 4*1024; > 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, 0, "Local domain"); > static SYSCTL_NODE(_net_local, SOCK_STREAM, stream, CTLFLAG_RW, 0, >@@ -180,6 +181,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, >@@ -464,9 +468,9 @@ > struct vattr vattr; > int error, namelen; > struct nameidata nd; >- struct unpcb *unp; >+ struct unpcb *unp, *unp2; > struct vnode *vp; > struct mount *mp; > cap_rights_t rights; > char *buf; > >@@ -522,8 +526,13 @@ > else > vput(nd.ni_dvp); > if (vp != NULL) { >+ if (bind_exist_errext == 1) >+ VOP_UNP_CONNECT(vp, &unp2); > vrele(vp); >- error = EADDRINUSE; >+ if (bind_exist_errext == 1 && unp2 == NULL) >+ error = EEXIST; >+ else >+ error = EADDRINUSE; > goto error; > } > error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 262172
:
232076
|
232077
| 232078 |
232079
|
232216