Skip to content
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

Tcp active open (wip) #9

Closed
wants to merge 4 commits into from

Conversation

little-dude
Copy link
Contributor

This is an attempt at providing a way to initiate a TCP connection (see #7).

I added an example to test the changes but this is not working yet. Here is what I get when running the client side:

[     0.026s] (socket::set): [0]: adding
[     0.026s] (socket::tcp): [0]192.168.69.2:6979:192.168.69.1:6970: state=CLOSED=>SYN-SENT
[     0.027s] (socket::tcp): [0]192.168.69.2:6979:192.168.69.1:6970: sending SYN
-> EthernetII src=02-00-00-00-00-02 dst=02-00-00-00-00-01 type=IPv4
   \ IPv4 src=192.168.69.2 dst=192.168.69.1 proto=TCP
    \ TCP src=6979 dst=6970 syn seq=0 ack=0 win=64 len=0 mss=1446
<- EthernetII src=02-00-00-00-00-01 dst=02-00-00-00-00-02 type=IPv4
   \ IPv4 src=192.168.69.1 dst=192.168.69.2 proto=TCP
    \ TCP src=6970 dst=6979 rst seq=0 ack=1 win=0 len=0
[     0.028s] (socket::tcp): [0]192.168.69.2:6979:192.168.69.1:6970: unacceptable RST|ACK in response to initial SYN

@little-dude
Copy link
Contributor Author

So the client sends a SYN+ACK instead of SYN, but I don't understand why yet.

@little-dude little-dude changed the title Tcp active open Tcp active open (wip) Mar 5, 2017
@little-dude
Copy link
Contributor Author

I got this wrong... State should be switched to ESTABLISHED after acknowledging the SYN-ACK...
Will continue tomorrow.

@whitequark
Copy link
Contributor

Don't bother. I am unhappy with the code quality anyway. I'll implement this myself.

@whitequark whitequark closed this Mar 5, 2017
@little-dude
Copy link
Contributor Author

Well that's pretty harsh. What is particularly bad about my code? Would you mind mentoring me instead? I'd like to learn, that's primarily why I'm playing with redox and smoltcp.

@whitequark
Copy link
Contributor

What is particularly bad about my code?

No tests (an example doesn't count as test), a large amount of missed subtleties of TCP. Ideally I aim for 100% condition/branch coverage though Rust makes it somewhat hard to achieve with all the overflow checks.

Would you mind mentoring me instead?

It took me weeks of full-time work to get a rudimentary understanding of how TCP works and how it should be implemented. I have neither time nor the depth of understanding to transfer that to someone else.

This isn't something about you personally and I intend you no offense. It's rather that my primary goal is to have a TCP stack that actually works decently, and mentoring someone is an extremely inefficient way to get there.

@whitequark
Copy link
Contributor

That being said, I will gladly accept any contributions (or mentor contributors) that don't touch the TCP state machine specifically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants