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

Take TCP Family into account before connecting #723

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion active_tcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func TestActiveTCP_Respect_NetworkTypes(t *testing.T) {
}()

cfg := &AgentConfig{
NetworkTypes: []NetworkType{NetworkTypeUDP4, NetworkTypeUDP6},
NetworkTypes: []NetworkType{NetworkTypeUDP4, NetworkTypeUDP6, NetworkTypeTCP6},
InterfaceFilter: problematicNetworkInterfaces,
IncludeLoopback: true,
}
Expand Down
13 changes: 8 additions & 5 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,14 +704,17 @@
}
}

tcpNetworkTypeFound := false
for _, networkType := range a.networkTypes {
if networkType.IsTCP() {
tcpNetworkTypeFound = true
acceptRemotePassiveTCPCandidate := false

Check warning on line 707 in agent.go

View check run for this annotation

Codecov / codecov/patch

agent.go#L707

Added line #L707 was not covered by tests
// Assert that TCP4 or TCP6 is a enabled NetworkType locally
if !a.disableActiveTCP && c.TCPType() == TCPTypePassive {
for _, networkType := range a.networkTypes {
if c.NetworkType() == networkType {
acceptRemotePassiveTCPCandidate = true

Check warning on line 712 in agent.go

View check run for this annotation

Codecov / codecov/patch

agent.go#L709-L712

Added lines #L709 - L712 were not covered by tests
}
}
}

if !a.disableActiveTCP && tcpNetworkTypeFound && c.TCPType() == TCPTypePassive {
if acceptRemotePassiveTCPCandidate {

Check warning on line 717 in agent.go

View check run for this annotation

Codecov / codecov/patch

agent.go#L717

Added line #L717 was not covered by tests
a.addRemotePassiveTCPCandidate(c)
}

Expand Down
Loading