tsnet: add test for packet filter generation from netmap

This is an integration test that covers all the code in Direct, Auto, and
LocalBackend that processes NetMaps and creates a Filter. The test uses
tsnet as a convenient proxy for setting up all the client pieces correctly,
but is not actually a test specific to tsnet.

Updates tailscale/corp#20514

Signed-off-by: James Sanderson <jsanderson@tailscale.com>
This commit is contained in:
James Sanderson
2025-03-21 09:30:42 +00:00
committed by James 'zofrex' Sanderson
parent 5be6ff9b62
commit 85a7abef0c
3 changed files with 254 additions and 2 deletions
+5 -1
View File
@@ -1510,7 +1510,11 @@ func (nb *nodeBackend) peerCapsLocked(src netip.Addr) tailcfg.PeerCapMap {
return nil
}
func (nb *nodeBackend) GetFilterForTest() *filter.Filter {
func (b *LocalBackend) GetFilterForTest() *filter.Filter {
if !testenv.InTest() {
panic("GetFilterForTest called outside of test")
}
nb := b.currentNode()
return nb.filterAtomic.Load()
}