Skip to content

Commit 15da49a

Browse files
committed
Ignore has_subnets at IPv6 part of dual stack network
But has_subnets ist still applied to network with both addresses having a /0 address. This closes #29
1 parent 15f7e4a commit 15da49a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

go/pkg/pass1/setup-objects.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ func (c *spoc) setupNetwork46(a *ast.Network) {
269269
n6.nat = nil
270270
c.setupNetwork2(n, na4)
271271
c.setupNetwork2(n6, na6)
272+
// Attribute 'has_subnets' is only applied to IPv6 part,
273+
// if both parts have prefix length 0 (the internet).
274+
if !(n.ipp.Bits() == 0 && n6.ipp.Bits() == 0) {
275+
n6.hasSubnets = false
276+
}
272277
} else if needV6 {
273278
n.ipV6 = true
274279
n.hosts = hosts6

go/testdata/ipv46-combined.t

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,33 @@ Warning: IPv6 network:n1 is subnet of IPv6 network:n2
15931593
and at IPv6 part declare attribute 'subnet_of'
15941594
=END=
15951595

1596+
############################################################
1597+
=TITLE=Warning at combined network with has_subnets ignored at v6 part
1598+
=INPUT=
1599+
network:n1 = { ip = 10.1.1.0/24; ip6 = 2001:db8:1:1::/64; }
1600+
network:n2 = { ip = 0.0.0.0/0; ip6 = 2001:db8:1:0::/48; has_subnets; }
1601+
router:r1 = {
1602+
interface:n1;
1603+
interface:n2;
1604+
}
1605+
=WARNING=
1606+
Warning: IPv6 network:n1 is subnet of IPv6 network:n2
1607+
in nat_domain:[network:n1].
1608+
If desired, split subnet into IPv4 and IPv6 part
1609+
and at IPv6 part declare attribute 'subnet_of'
1610+
=END=
1611+
1612+
############################################################
1613+
=TITLE=Attribute has_subnets at combined network is not ignored with /0
1614+
=INPUT=
1615+
network:n1 = { ip = 10.1.1.0/24; ip6 = 2001:db8:1:1::/64; }
1616+
network:n2 = { ip = 0.0.0.0/0; ip6 = ::/0; has_subnets; }
1617+
router:r1 = {
1618+
interface:n1;
1619+
interface:n2;
1620+
}
1621+
=WARNING=NONE
1622+
15961623
############################################################
15971624
=TITLE=Missing owner for v6 part
15981625
=INPUT=

0 commit comments

Comments
 (0)