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

Have lighthouses ack updates to reduce test packet traffic #851

Merged
merged 2 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 connection_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func (n *connectionManager) makeTrafficDecision(localIndex uint32, p, nb, out []
n.sendPunch(hostinfo)
}

if n.intf.lightHouse.IsLighthouseIP(hostinfo.vpnIp) {
if !n.punchy.GetTestLighthouses() && n.intf.lightHouse.IsLighthouseIP(hostinfo.vpnIp) {
// We are sending traffic to the lighthouse, let recv_error sort out any issues instead of testing the tunnel
n.trafficTimer.Add(hostinfo.localIndexId, n.checkInterval)
return doNothing, nil, nil
Expand Down
7 changes: 7 additions & 0 deletions examples/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ lighthouse:
hosts:
- "192.168.100.1"

# Toggle sending test packets to lighthouse hosts to assert the tunnels are still viable.
# Disabling sending test packets to lighthouses can reduce bookkeeping traffic
# and load on lighthouses with many tunnels.
# Setting to false may lead to connectivity issues if a lighthouse host is behind a NAT or firewall that
# tracks outbound packets from the lighthouse to the clients.
#send_test_packets: true

# remote_allow_list allows you to control ip ranges that this node will
# consider when handshaking to another node. By default, any remote IPs are
# allowed. You can provide CIDRs here with `true` to allow and `false` to
Expand Down
12 changes: 12 additions & 0 deletions punchy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Punchy struct {
delay atomic.Int64
respondDelay atomic.Int64
punchEverything atomic.Bool
testLighthouses atomic.Bool
l *logrus.Logger
}

Expand Down Expand Up @@ -87,6 +88,13 @@ func (p *Punchy) reload(c *config.C, initial bool) {
p.l.Infof("punchy.respond_delay changed to %s", p.GetRespondDelay())
}
}

if initial || c.HasChanged("lighthouse.send_test_packets") {
p.testLighthouses.Store(c.GetBool("lighthouse.send_test_packets", true))
if !initial {
p.l.Infof("lighthouse.send_test_packets changed to %v", p.GetTestLighthouses())
}
}
}

func (p *Punchy) GetPunch() bool {
Expand All @@ -108,3 +116,7 @@ func (p *Punchy) GetRespondDelay() time.Duration {
func (p *Punchy) GetTargetEverything() bool {
return p.punchEverything.Load()
}

func (p *Punchy) GetTestLighthouses() bool {
return p.testLighthouses.Load()
}