mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-10 19:17:25 +02:00
policy/policyutil: update ReduceFilterRules test expectations for IPv6
Now that AppendToIPSet includes both IPv4 and IPv6, tests with nodes that have IPv6 addresses produce additional entries in SrcIPs and DstPorts. Update the expected values accordingly. Updates #2180
This commit is contained in:
@@ -209,12 +209,17 @@ func TestReduceFilterRules(t *testing.T) {
|
||||
{
|
||||
SrcIPs: []string{
|
||||
"100.64.0.1-100.64.0.2",
|
||||
"fd7a:115c:a1e0::1-fd7a:115c:a1e0::2",
|
||||
},
|
||||
DstPorts: []tailcfg.NetPortRange{
|
||||
{
|
||||
IP: "100.64.0.1",
|
||||
Ports: tailcfg.PortRangeAny,
|
||||
},
|
||||
{
|
||||
IP: "fd7a:115c:a1e0::1",
|
||||
Ports: tailcfg.PortRangeAny,
|
||||
},
|
||||
{
|
||||
IP: "10.33.0.0/16",
|
||||
Ports: tailcfg.PortRangeAny,
|
||||
@@ -347,7 +352,10 @@ func TestReduceFilterRules(t *testing.T) {
|
||||
// autogroup:internet does NOT generate packet filters - it's handled
|
||||
// by exit node routing via AllowedIPs, not by packet filtering.
|
||||
{
|
||||
SrcIPs: []string{"100.64.0.1-100.64.0.2"},
|
||||
SrcIPs: []string{
|
||||
"100.64.0.1-100.64.0.2",
|
||||
"fd7a:115c:a1e0::1-fd7a:115c:a1e0::2",
|
||||
},
|
||||
DstPorts: []tailcfg.NetPortRange{
|
||||
{
|
||||
IP: "100.64.0.100",
|
||||
@@ -447,7 +455,10 @@ func TestReduceFilterRules(t *testing.T) {
|
||||
want: []tailcfg.FilterRule{
|
||||
// Merged: Both ACL rules combined (same SrcIPs)
|
||||
{
|
||||
SrcIPs: []string{"100.64.0.1-100.64.0.2"},
|
||||
SrcIPs: []string{
|
||||
"100.64.0.1-100.64.0.2",
|
||||
"fd7a:115c:a1e0::1-fd7a:115c:a1e0::2",
|
||||
},
|
||||
DstPorts: []tailcfg.NetPortRange{
|
||||
{
|
||||
IP: "100.64.0.100",
|
||||
@@ -549,7 +560,10 @@ func TestReduceFilterRules(t *testing.T) {
|
||||
want: []tailcfg.FilterRule{
|
||||
// Merged: Both ACL rules combined (same SrcIPs)
|
||||
{
|
||||
SrcIPs: []string{"100.64.0.1-100.64.0.2"},
|
||||
SrcIPs: []string{
|
||||
"100.64.0.1-100.64.0.2",
|
||||
"fd7a:115c:a1e0::1-fd7a:115c:a1e0::2",
|
||||
},
|
||||
DstPorts: []tailcfg.NetPortRange{
|
||||
{
|
||||
IP: "100.64.0.100",
|
||||
@@ -629,7 +643,10 @@ func TestReduceFilterRules(t *testing.T) {
|
||||
want: []tailcfg.FilterRule{
|
||||
// Merged: Both ACL rules combined (same SrcIPs)
|
||||
{
|
||||
SrcIPs: []string{"100.64.0.1-100.64.0.2"},
|
||||
SrcIPs: []string{
|
||||
"100.64.0.1-100.64.0.2",
|
||||
"fd7a:115c:a1e0::1-fd7a:115c:a1e0::2",
|
||||
},
|
||||
DstPorts: []tailcfg.NetPortRange{
|
||||
{
|
||||
IP: "100.64.0.100",
|
||||
@@ -696,12 +713,19 @@ func TestReduceFilterRules(t *testing.T) {
|
||||
},
|
||||
want: []tailcfg.FilterRule{
|
||||
{
|
||||
SrcIPs: []string{"100.64.0.1"},
|
||||
SrcIPs: []string{
|
||||
"100.64.0.1",
|
||||
"fd7a:115c:a1e0::1",
|
||||
},
|
||||
DstPorts: []tailcfg.NetPortRange{
|
||||
{
|
||||
IP: "100.64.0.100",
|
||||
Ports: tailcfg.PortRangeAny,
|
||||
},
|
||||
{
|
||||
IP: "fd7a:115c:a1e0::100",
|
||||
Ports: tailcfg.PortRangeAny,
|
||||
},
|
||||
{
|
||||
IP: "172.16.0.21",
|
||||
Ports: tailcfg.PortRangeAny,
|
||||
|
||||
Reference in New Issue
Block a user