-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DoIP improvements all-around #510
Conversation
What' the rational of b8c3ce0? This code seems unfortunate to me. Why is writing random data to a connection needed to close it? |
As mentioned in the log message and according to what you wrote yourself, the rationale is to "to help our kernel realize the connection is closed to avoid TIME_WAIT". Apparently this is due to implementation details of asyncio's open_connection, having a stream reader/writer on both ends that do not directly communicate, iirc. In any case, without this change the DoIP discoverer occupies up to 13.000 Ports while enumerating, as they are not properly closed. |
With recent changes this PR now fully surpasses #506 Additional content includes:
|
And even more feats:
Apart from that some minor fixups for previous commits; so once done this needs to be rebased |
For the record, discussed via matrix. ACK, but these points are open:
socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setblocking(False)
sock.bind(("0.0.0.0", 0))
loop = asyncio.get_running_loop()
data, addr = await loop.sock_recvfrom(sock, …)
await loop.sock_sendto(sock, …)
|
a834b43
to
2129da3
Compare
According to the standard the DoIP entity can respond with only part of what was initially sent. This is true both for 2019 and 2012 versions of the standard.
It is up to the DoIP entity to decide whether it first checks for correct SourceAddress or RoutingActivationType (while the standard actually puts the check for SourceAddress first...). This commit minimizes the search space by determining which check is performed first, and accordingly adapting the following scans. By doing so it also removes code duplication.
b98900c
to
2742a89
Compare
All comments should be addressed. Maybe let it rest for a day to let me double check tomorrow, otherwise it should be good to merge. |
And for the record: this MR fully surpasses and thus closes #506 |
This PR contains multiple fixes that: