-
Notifications
You must be signed in to change notification settings - Fork 114
NTCP: multiple core issues #187
Comments
To clarify: these issues existed before our first Kovri commit; so we have always had these issues. |
NTCPSession::HandleReceivedPayload
See monero-project#187. * Correctly deal with short messages. * Read asynchronously. * Stop reading when an EOF error occurs.
See issue monero-project#187 and commit bead4f6. In NTCPServer::HandleReceivedPayload.
See monero-project#187 NTCPSession::ReceivedPayload, NTCPSession::HandleReceivedPayload
I can confirm that (at commit 65f8ee1) in principle it is possible to build tunnels using only NTCP. Some unresolved errors: (ticked if resolved by now)
The first error seems to be the most common one. Even if it is really not possible to connect to the remote endpoint, we should still avoid having to restart the I/O service. |
See monero-project#187. NTCPSession::HandleReceivedPayload, check whether m_NextMessage == nullptr
See monero-project#187. NTCPServer: Add NTCP session after connecting.
2c66a3f Avoid signed-unsigned comparison (EinMByte) 9e9770c Fix typo in TODO. (EinMByte) d6d952c Fix #334. (EinMByte) 6b99292 Fix bad file descriptor error (EinMByte) 1b4dc54 Reschedule and flush after receiving full message (EinMByte) 65f8ee1 Do not require all bytes to be transferred (EinMByte) 40408b7 Add TODO about flushing m_Handler. (EinMByte) bead4f6 Improvements to NTCPSession::HandleReceivedPayload (EinMByte) 3753198 Do not ban peers for sending short messages (#187) (EinMByte) 351a527 Do not throw when connection fails (EinMByte) 4b0249f Add options to disable SSU/NTCP (fixes #184) (EinMByte)
See monero-project#187 NTCPSession::GetFormattedSessionInfo
All that remains is point 4. in OP and the remaining two box options in @EinMByte's comment above. Removing critical label. |
@EinMByte something I noticed earlier today when dealing with another issue: if you look inside Side-note: an RI unit-test and/or an RI validator as mentioned in #399 would be of use. I'll write the unit-test or both when the time comes (I don't think it will help much for NTCP right now though). |
I thought this issue would have a log snippet by now (we've done most of our debugging on IRC) so I've attached a tcpdump and kovri log snippet with scrubbed addresses (built against 9d44c0d).
|
JFTR: when working on #545, I noticed that tunnel building with I don't remember the last time I tried to run an NTCP-only router (no earlier that November apparently) but even then, I don't remember testing tunnel usability (though I do remember it being reliable at some point). Note: @EinMByte's 7e32943 was the most recent commit in this area (though this issue could predate that). |
@anonimal We should probably discuss this issue on IRC. I do remember that at some point, NTCP only was at least partially working (at this time SSU was not working). I've always used |
@EinMByte ok, sounds great. I'll give you a ping next week. Now that milestone issues are nearing completion, I planned on getting back to this issue once the osx/windows issues we spoke about (not NTCP) were resolved. |
NOTICE: THIS ISSUE HAS BEEN MOVED TO GitLab. Please continue the discussion there. See #1013 for details. |
By submitting this issue, I confirm the following:
Place an X inside the bracket to confirm
Up until very recently, with full knowledge of the quality of this code-base and the many security issues/issues at-large (many of which have been resolved), I had never ran Kovri over clearnet - not once - since the first Kovri commit. That's over 6+ months of non-clearnet development! Instead, I had been using a Tor transproxy to do the myriad of other other critical/major/misc development that was needed - but did not require clearnet access.
Now that I am regularly developing Kovri over clearnet, core issues have been exposed of which I would have caught earlier had I been able to safely develop over clearnet (I had assumed some of these issues were transproxy-related and I also did not have proper debugging output until fe9654a). One of these core issues is an apparently very broken NTCP implementation.
An example, as seen in every NTCP session (Edit: i.e., every session that successfully connects and completes the 4-phase message sequence):
So, at first glance, the issues being:
1. Peer closes connection for currently unknown reasonsEdit: fixed2. We ban every NTCP peer because of said reason (or simply because they closed the connection). Why do they close the connection and why exactly are we banning? Once we find the reason for 1, we should review why we ban.Edit: fixedAlso,
3. When stopping the router:
Edit: fixed2016:05:29|07:08:59.634290 default:default DBG NTCPSession: [] 0.0.0.0:0 *** destroying session
At times this can appear a multiple of times, I've seen upwards of 20 times. Why are sessions being established to
0.0.0.0:0
and why so many times?And lastly,
4.
NTCPServer
appears to be incomplete, and also does not process any incoming TCP connections. This is a big. The whole point of P2P is to accept and relay traffic.Kovri is literally running on one leg by only using SSU.Edit: outbound NTCP is now functional. Also, our improper NTCP handling may watermark our router to observant peers or ISPs.I need more time to review. Fixes may be simple and/or they may come along with a completed NTCP implementation. I'm labeling this issue as critical because of the potential security implications. Otherwise, it's simply a major bug.
The text was updated successfully, but these errors were encountered: