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

net/tstun: use gaissmai/bart instead of tempfork/device #11488

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

oxtoacart
Copy link
Contributor

This implementation uses less memory than tempfork/device, which helps avoid OOM conditions in the iOS VPN extension when switching to a Tailnet with ExitNode routing enabled.

Updates tailscale/corp#18514

net/tstun/table/table.go Outdated Show resolved Hide resolved
net/tstun/wrap.go Outdated Show resolved Hide resolved
@bradfitz bradfitz removed their request for review March 22, 2024 20:30
@oxtoacart oxtoacart force-pushed the oxtocart/allowed_ips_efficiency branch from 6affc07 to 44dbfb6 Compare March 22, 2024 22:24
count[v]++
return true
})
// count := map[netip.Addr]int{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not have commented out code here. This was to get the build passing in the patch 😅
We can track the counts when building the table and then just use the value directly here

}
if len(listenAddrs) == 0 && len(dstMasqAddrs) == 0 {
if len(listenAddrs) == 0 && needMasq {
Copy link
Collaborator

Choose a reason for hiding this comment

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

!needMasq

rt.InsertOrReplace(p.PublicKey, p.AllowedIPs...)
mak.Set(&dstMasqAddrs, p.PublicKey, addrToUse)
for _, ip := range p.AllowedIPs {
needMasq = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can probably do this outside the allowed ips loops

@oxtoacart oxtoacart force-pushed the oxtocart/allowed_ips_efficiency branch from 44dbfb6 to 8d68c40 Compare March 24, 2024 16:30
This implementation uses less memory than tempfork/device,
which helps avoid OOM conditions in the iOS VPN extension when
switching to a Tailnet with ExitNode routing enabled.

Updates tailscale/corp#18514

Signed-off-by: Percy Wegmann <percy@tailscale.com>
@oxtoacart oxtoacart force-pushed the oxtocart/allowed_ips_efficiency branch from 8d68c40 to 236c8b3 Compare March 24, 2024 16:33
@oxtoacart
Copy link
Contributor Author

@maisem I've addressed your latest comments.

Copy link
Collaborator

@maisem maisem left a comment

Choose a reason for hiding this comment

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

Thanks!

@oxtoacart
Copy link
Contributor Author

Thanks for the review @maisem !

@oxtoacart oxtoacart merged commit 8b8b315 into main Mar 25, 2024
46 checks passed
@oxtoacart oxtoacart deleted the oxtocart/allowed_ips_efficiency branch March 25, 2024 17:31
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.

None yet

2 participants