Skip to content

intra/tcp.go: don't create TCP endpoint before Dial() returns #149

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

Draft
wants to merge 1 commit into
base: n2
Choose a base branch
from

Conversation

Lanius-collaris
Copy link
Contributor

@ignoramous
I wonder if this change breaks anything.

@ignoramous
Copy link
Contributor

dnsOverride in L190 assumes a connected gconn.

On the diff, before return err, the egressing conn, pc, must be clos()d.

@@ -270,6 +262,11 @@ func (h *tcpHandler) handle(px ipn.Proxy, src net.Conn, boundSrc, target netip.A
return err
}

gconn := src.(*netstack.GTCPConn)
if open, err := gconn.Establish(); !open {
Copy link
Contributor

@ignoramous ignoramous Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check here should be err != nil.

- if open, err := gconn.Establish(); !open {
+ if _, err := gconn.Establish(); err != nil {
+     clos(pc)

Code is called in a loop, and so, subsequent Establish() will result in open==false (but err would be nil).

if g.ok() { // already setup
return false, nil // open, err free
}


Think I'll have to look more closely on what other changes might be needed to move Establish here.

What is the reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this change?

To complete the experiment in commit b139771

I will play with this draft later.

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

Successfully merging this pull request may close these issues.

2 participants