mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 23:46:52 +01:00
no bart for cidr
This commit is contained in:
1 parent
f3b76703ae
commit
9aab46c1ad
4 files changed
+65
-27
No files matched your search
@@ -389,8 +389,36 @@ func BenchmarkFirewallTable_match(b *testing.B) {
|
||||
ft.Match(&firewall.Packet{Protocol: iputil.IPProtocolTCP, LocalPort: 10}, true, c, cp)
|
||||
}
|
||||
})
|
||||
|
||||
// The port 10 rules have a cidr, this cert fails their group and host so only the cidr can pass them
|
||||
cidrCert := &cert.CachedCertificate{
|
||||
Certificate: &dummyCert{name: "nope"},
|
||||
InvertedGroups: map[string]struct{}{"nope": {}},
|
||||
}
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
addr netip.Addr
|
||||
want bool
|
||||
}{
|
||||
{"pass on cidr", pfix.Addr(), true},
|
||||
{"pass on cidr6", pfix6.Addr(), true},
|
||||
{"pass proto, port, fail group and name, fail on cidr", netip.MustParseAddr("9.254.254.245"), false},
|
||||
{"pass proto, port, fail group and name, fail on cidr6", netip.MustParseAddr("fd99::99"), false},
|
||||
} {
|
||||
p := &firewall.Packet{Protocol: iputil.IPProtocolTCP, LocalPort: 10, RemoteAddr: tc.addr}
|
||||
b.Run(tc.name, func(b *testing.B) {
|
||||
if ft.Match(p, true, cidrCert, cp) != tc.want {
|
||||
b.Fatal("wrong verdict")
|
||||
}
|
||||
for b.Loop() {
|
||||
benchMatchSink = ft.Match(p, true, cidrCert, cp)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var benchMatchSink bool
|
||||
|
||||
func TestFirewall_Drop2(t *testing.T) {
|
||||
ob := &bytes.Buffer{}
|
||||
l := test.NewLoggerWithOutput(ob)
|
||||
|
||||
Reference in new issue
Block a user