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
01d05baa
Commit
01d05baa
authored
Jun 28, 2023
by
Ally Sommers
Committed by
Alexandre Julliard
Jul 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add test for sendto() and recvfrom() on TCP sockets.
parent
7b2e7c80
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
sock.c
dlls/ws2_32/tests/sock.c
+34
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
01d05baa
...
...
@@ -13785,6 +13785,39 @@ static void test_connect_udp(void)
closesocket
(
client
);
}
static
void
test_tcp_sendto_recvfrom
(
void
)
{
SOCKET
client
,
server
=
0
;
SOCKADDR_IN
addr
=
{
AF_INET
,
SERVERPORT
};
SOCKADDR_IN
bad_addr
,
bad_addr_copy
;
const
char
serverMsg
[]
=
"ws2_32/TCP socket test"
;
char
clientBuf
[
sizeof
(
serverMsg
)]
=
{
0
};
int
to_len
=
0xc0ffee11
;
int
ret
;
inet_pton
(
AF_INET
,
SERVERIP
,
&
addr
.
sin_addr
);
tcp_socketpair
(
&
client
,
&
server
);
memset
(
&
bad_addr
,
0xfe
,
sizeof
(
bad_addr
));
memcpy
(
&
bad_addr_copy
,
&
bad_addr
,
sizeof
(
bad_addr_copy
));
ret
=
sendto
(
server
,
serverMsg
,
sizeof
(
serverMsg
),
0
,
(
SOCKADDR
*
)
&
bad_addr
,
sizeof
(
bad_addr
));
ok
(
ret
==
sizeof
(
serverMsg
),
"Incorrect return value from sendto: %d (%d)
\n
"
,
ret
,
WSAGetLastError
());
ok
(
!
memcmp
(
&
bad_addr
,
&
bad_addr_copy
,
sizeof
(
bad_addr
)),
"Provided address modified by sendto
\n
"
);
ok
(
to_len
==
0xc0ffee11
,
"Provided size modified by sendto
\n
"
);
ret
=
recvfrom
(
client
,
clientBuf
,
sizeof
(
clientBuf
),
0
,
(
SOCKADDR
*
)
&
bad_addr
,
&
to_len
);
ok
(
ret
==
sizeof
(
serverMsg
),
"Incorrect return value from recvfrom: %d (%d)
\n
"
,
ret
,
WSAGetLastError
());
ok
(
!
memcmp
(
&
bad_addr
,
&
bad_addr_copy
,
sizeof
(
bad_addr
)),
"Provided address modified by recvfrom
\n
"
);
ok
(
to_len
==
0xc0ffee11
,
"Provided size modified by recvfrom
\n
"
);
ok
(
!
memcmp
(
serverMsg
,
clientBuf
,
sizeof
(
serverMsg
)),
"Data mismatch over TCP socket
\n
"
);
closesocket
(
client
);
closesocket
(
server
);
}
START_TEST
(
sock
)
{
int
i
;
...
...
@@ -13866,6 +13899,7 @@ START_TEST( sock )
test_tcp_reset
();
test_icmp
();
test_connect_udp
();
test_tcp_sendto_recvfrom
();
/* this is an io heavy test, do it at the end so the kernel doesn't start dropping packets */
test_send
();
...
...
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