Syn-C | Turbo C code to ANSI C code converter | 3D Printing library
kandi X-RAY | Syn-C Summary
kandi X-RAY | Syn-C Summary
Input: Turbo C compliant code Output Generated: Equivalent ANSI C code. Lexical Analysis performed using [C-Source Scanner] XML Parser uses [PugiXML] Dependencies: + GCC-G++ + Make + [FLEX] + Java Development Kit. Authors (In alphabetical order): + Akshay Katyal | [MrDHat] + Rachit Gupta | [R4CHI7] + Sidharth Kathuria | [siddharth124] The project is incomplete and is missing a lot of function definitions in the XML files. Not suitable for production as of now. Licensed under GNU GPLv3.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Syn-C
Syn-C Key Features
Syn-C Examples and Code Snippets
Community Discussions
Trending Discussions on Syn-C
QUESTION
I wrote user-mode client-server c application based on Berkeley sockets that interact over some private network.
The situation is definitely strange. Occasionally the connection becomes very slow under some vague circumstances. The normal TCP data exchange in my case is about 10-25 Kbytes payload per segment, but sometimes it becomes about ~200-500 bytes per segment.
After some troubleshooting, I realized that this problem is not reproducible for other network services, thus it looks like my service is to blame. But I can't figure out, what's wrong. It worked well on 3.10 Linux kernel, but have that strange behavior on 4.4. Could it be some internal kernel changes which caused such problem?
I tried to play with Linux sysctl
settings:
ANSWER
Answered 2020-Jan-27 at 13:14I'm not really sure this is exactly your case, but it looks similar. Seems that it's a known problem.
ReasonsA number of circumstances can lead to such Linux kernel behavior:
- Specificity of kernel connection handling in SYN-cookies context with connections having zero Window Scale (or if WS modified in some other way).
- Zero Window Scale you provoked by
setsockopt()
withSO_RCVBUF
(seetcp_select_initial_window()
) - Extremely small
backlog
About "slow" transmission:
The Windows Scaling option is calculated at [SYN - SYN+ACK] stage by both hosts. Roughly speaking Host A says "imply my TCP window size on N during future exchange" (SYN) then Host B says "imply my TCP window size on M during future exchange" (SYN+ACK) - here N and M could be th same. So, in a normal situation, these coefficients are stored and eventually used while data exchange.
But TCP SYN-cookies technique implies forgetfulness about [SYN - SYN+ACK] stage of connection (some stated options including WS will be lost after SYN+ACK). In that case Linux kernel re-calculates WS value when ACK arrives (if the ACK has arrived, then creating a regular connection is needed). But that second recalculation could be a bit different because setsockopt()
does not affect it (for some objective reasons). Here you face with situation, when your server sends zero Window Scale option with SYN+ACK, then forgets about it, then re-spawn connection (when ACK arrives) as it was with some default Window Scale (e.g. 7) and use little window implying that client will multiply it by 128. But client doesn't forget that WS is 0 and treats little window size as real - hence it send a little portions of data - hereby your "slow" connection takes the stage.
About SYN-flood:
When you have such a little backlog an simple 3 SYN-retransmits can provoke SYN-cookies (i.e. will fill in your backlog queue). BTW do you see retransmissions in tcpdump?
From ip-sysctl.txt:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Syn-C
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page