Problems of AF_INET domain socket regarding out-of-band data.
Takashi Yano
takashi.yano@nifty.ne.jp
Wed Jun 13 15:02:00 GMT 2018
Hello,
I have found a few problems of AF_INET domain socket regarding
out-of-band data.
1. recv() with MSG_OOB flag eats normal data if no OOB data
is sent yet.
2. Calling recv() with MSG_OOB flag is blocked if no OOB data
is sent yet.
3. Calling recv() without MSG_OOB flag after receiving OOB data
is blocked even if received data exist in buffer.
Regarding problem 1 and 2, POSIX states as follows about recv().
[EINVAL]
The MSG_OOB flag is set and no out-of-band data is available.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html
Attached is a sample program to reproduce these problems.
Argument to this program specifies the test mode.
0: cause problem 1
2: cause problem 2
3: cause problem 3
Expected results:
debian:~/OOB> ./server_client 0
recv(OOB): Invalid argument
OOB : (-1)
NORMAL: 1234567890 (10)
debian:~/OOB> ./server_client 1
OOB : A (1)
NORMAL: 1234567890 (10)
debian:~/OOB> ./server_client 2
recv(OOB): Invalid argument
OOB : (-1)
NORMAL: 1234567890 (10)
debian:~/OOB> ./server_client 3
OOB : A (1)
NORMAL: 1234567890 (10)
debian:~/OOB>
Result on cygwin:
[yano@Express5800-S70 ~/OOB]$ ./server_client 0
OOB : 1234567890 (10)
NORMAL: (0)
[yano@Express5800-S70 ~/OOB]$ ./server_client 1
OOB : A (1)
NORMAL: 1234567890 (10)
[yano@Express5800-S70 ~/OOB]$ ./server_client 2
[yano@Express5800-S70 ~/OOB]$ ./server_client 3
OOB : A (1)
[yano@Express5800-S70 ~/OOB]$
Only the result of test mode 1 is as expected.
I have confirmed this occurs in both latest 32bit and 64 bit
cygwin.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: server_client.c
Type: text/x-csrc
Size: 2632 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20180613/e89bff19/attachment.bin>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list