Bug 76521
Summary: | no-blocking socket can send data through non-existent local port | ||
---|---|---|---|
Product: | Networking | Reporter: | billhong1998 (billhong1998) |
Component: | IPV4 | Assignee: | Stephen Hemminger (stephen) |
Status: | NEW --- | ||
Severity: | high | CC: | eric.dumazet, szg00000 |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 3.11.0-15 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
Run code to reproduce the issue
2nd version bug report source code, 'gcc -o findbug findbug.c' and run it final version |
What guarantee do you have port 8888 is not used ? If you change 8888 to say 777 (notice its not 7777, but 777), is the 'bug' happening ? This looks like SYN crossing, which is allowed by TCP protocol. Created attachment 138331 [details]
2nd version bug report source code, 'gcc -o findbug findbug.c' and run it
The attached code(findbug.c) is an improved version. Local host ip address and port can be designated, for example ./findbug 127.0.0.1 777
And there is another question: The code will stop accepting event eventually after a long while. Is there a punitive algorithm in the case?
(In reply to Eric Dumazet from comment #1) > What guarantee do you have port 8888 is not used ? > > If you change 8888 to say 777 (notice its not 7777, but 777), > is the 'bug' happening ? > > This looks like SYN crossing, which is allowed by TCP protocol. Eric, thank you for providing the right direction helping me find the eventual problem. It does not matter to non-blocking io and epoll. It just a weird thing, which probably does not threaten system security, but in some cases, it could hinder some people like me to write right code. Maybe I have to remember not to use the same socket number which services used since I could not guarantee my code not running in the case of connecting local listening port. Created attachment 138551 [details]
final version
|
Created attachment 136811 [details] Run code to reproduce the issue The attached code is a epoll network client supposed to test a network server in high traffic case. Multiple threads create non-blocking sockets to simulate heavy network load. Most sockets work well, but occasionally some sockets can send data via non-existent local port, and can read data from the port as well. Maybe I am not acquainted enough with epoll networking programming, and even not sure if it is a bug in no-blocking i/o or epoll, and also not certain which websites are the right place to discuss epoll or no-blocking i/o technologies. Anyone has any ideas would be greatly appreciated. Thanks.