Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9eea22f7
Commit
9eea22f7
authored
Jun 29, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Jun 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Move the setsockopt(SO_REUSEADDR) implementation to ntdll.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f7cb96e5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
socket.c
dlls/ntdll/unix/socket.c
+20
-0
socket.c
dlls/ws2_32/socket.c
+3
-10
afd.h
include/wine/afd.h
+1
-0
No files found.
dlls/ntdll/unix/socket.c
View file @
9eea22f7
...
...
@@ -1655,6 +1655,26 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
case
IOCTL_AFD_WINE_GET_SO_REUSEADDR
:
return
do_getsockopt
(
handle
,
io
,
SOL_SOCKET
,
SO_REUSEADDR
,
out_buffer
,
out_size
);
/* BSD socket SO_REUSEADDR is not 100% compatible to winsock semantics;
* however, using it the BSD way fixes bug 8513 and seems to be what
* most programmers assume, anyway */
case
IOCTL_AFD_WINE_SET_SO_REUSEADDR
:
{
int
fd
,
needs_close
=
FALSE
;
NTSTATUS
status
;
int
ret
;
if
((
status
=
server_get_unix_fd
(
handle
,
0
,
&
fd
,
&
needs_close
,
NULL
,
NULL
)))
return
status
;
ret
=
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
in_buffer
,
in_size
);
#ifdef __APPLE__
if
(
!
ret
)
ret
=
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEPORT
,
in_buffer
,
in_size
);
#endif
if
(
needs_close
)
close
(
fd
);
return
ret
?
sock_errno_to_status
(
errno
)
:
STATUS_SUCCESS
;
}
default:
{
if
((
code
>>
16
)
==
FILE_DEVICE_NETWORK
)
...
...
dlls/ws2_32/socket.c
View file @
9eea22f7
...
...
@@ -3572,6 +3572,9 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
case
WS_SO_RCVTIMEO
:
return
server_setsockopt
(
s
,
IOCTL_AFD_WINE_SET_SO_RCVTIMEO
,
optval
,
optlen
);
case
WS_SO_REUSEADDR
:
return
server_setsockopt
(
s
,
IOCTL_AFD_WINE_SET_SO_REUSEADDR
,
optval
,
optlen
);
/* Some options need some conversion before they can be sent to
* setsockopt. The conversions are done here, then they will fall through
* to the general case. Special options that are not passed to
...
...
@@ -3588,16 +3591,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
convert_sockopt
(
&
level
,
&
optname
);
break
;
/* The options listed here don't need any special handling. Thanks to
* the conversion happening above, options from there will fall through
* to this, too.*/
/* BSD socket SO_REUSEADDR is not 100% compatible to winsock semantics.
* however, using it the BSD way fixes bug 8513 and seems to be what
* most programmers assume, anyway */
case
WS_SO_REUSEADDR
:
convert_sockopt
(
&
level
,
&
optname
);
break
;
/* SO_DEBUG is a privileged operation, ignore it. */
case
WS_SO_DEBUG
:
TRACE
(
"Ignoring SO_DEBUG
\n
"
);
...
...
include/wine/afd.h
View file @
9eea22f7
...
...
@@ -174,6 +174,7 @@ struct afd_get_events_params
#define IOCTL_AFD_WINE_SET_SO_RCVTIMEO CTL_CODE(FILE_DEVICE_NETWORK, 231, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_WINE_GET_SO_RCVTIMEO CTL_CODE(FILE_DEVICE_NETWORK, 232, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_WINE_GET_SO_REUSEADDR CTL_CODE(FILE_DEVICE_NETWORK, 233, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFD_WINE_SET_SO_REUSEADDR CTL_CODE(FILE_DEVICE_NETWORK, 234, METHOD_BUFFERED, FILE_ANY_ACCESS)
struct
afd_create_params
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment