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
039f8b16
Commit
039f8b16
authored
Oct 15, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Oct 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move SO_REUSEADDR handling to server.
parent
c6da6919
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
21 deletions
+41
-21
socket.c
dlls/ntdll/unix/socket.c
+0
-21
sock.c
server/sock.c
+41
-0
No files found.
dlls/ntdll/unix/socket.c
View file @
039f8b16
...
...
@@ -1977,27 +1977,6 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
case
IOCTL_AFD_WINE_SET_SO_OOBINLINE
:
return
do_setsockopt
(
handle
,
io
,
SOL_SOCKET
,
SO_OOBINLINE
,
in_buffer
,
in_size
);
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
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
status
=
ret
?
sock_errno_to_status
(
errno
)
:
STATUS_SUCCESS
;
break
;
}
case
IOCTL_AFD_WINE_SET_IP_ADD_MEMBERSHIP
:
return
do_setsockopt
(
handle
,
io
,
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
in_buffer
,
in_size
);
...
...
server/sock.c
View file @
039f8b16
...
...
@@ -2905,6 +2905,29 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
return
;
}
/* 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
reuse
,
ret
;
if
(
get_req_data_size
()
<
sizeof
(
reuse
))
{
set_error
(
STATUS_BUFFER_TOO_SMALL
);
return
;
}
reuse
=
*
(
int
*
)
get_req_data
();
ret
=
setsockopt
(
unix_fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
reuse
,
sizeof
(
reuse
)
);
#ifdef __APPLE__
if
(
!
ret
)
ret
=
setsockopt
(
unix_fd
,
SOL_SOCKET
,
SO_REUSEPORT
,
&
reuse
,
sizeof
(
reuse
)
);
#endif
if
(
ret
)
set_error
(
sock_get_ntstatus
(
errno
)
);
return
;
}
case
IOCTL_AFD_WINE_GET_SO_SNDBUF
:
{
int
sndbuf
=
sock
->
sndbuf
;
...
...
@@ -2992,6 +3015,24 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
return
;
}
case
IOCTL_AFD_WINE_GET_SO_REUSEADDR
:
{
int
reuse
;
socklen_t
len
=
sizeof
(
reuse
);
if
(
!
get_reply_max_size
())
{
set_error
(
STATUS_BUFFER_TOO_SMALL
);
return
;
}
if
(
!
getsockopt
(
unix_fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
reuse
,
&
len
))
set_reply_data
(
&
reuse
,
min
(
sizeof
(
reuse
),
get_reply_max_size
()
));
else
set_error
(
sock_get_ntstatus
(
errno
)
);
return
;
}
case
IOCTL_AFD_POLL
:
{
if
(
get_reply_max_size
()
<
get_req_data_size
())
...
...
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