Skip to content

Commit

Permalink
Show IPv4 areas for combined zone
Browse files Browse the repository at this point in the history
Must not accidently overwrite v4 areas by v6 areas, when combined
zones have same name.
  • Loading branch information
hknutzen committed Dec 17, 2024
1 parent b8a4acd commit 947c0c5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{{$NEXT}}

- Fixed command 'export-netspoc'.
Show IPv4 areas for combined zone. Must not accidently overwrite
IPv4 areas by IPv6 areas, when combined zones have same name.

6.074 2024-12-16 11:52:23+01:00 Europe/Berlin

- Fixed wrong error on duplicate interface from router in ipv6/ directory.
Expand Down
10 changes: 9 additions & 1 deletion go/pkg/pass1/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,17 @@ func ipNatForObject(obj srvObj, dst jsonMap) {
}
}

// Zone with network 0/0 doesn't have an aggregate 0/0.
func (c *spoc) getZoneName(z *zone) string {
// Ignore IPv6 part of dual stack zone.
// This must match check in exportZone2Areas.
if z.ipV6 && z.combined46 != nil {
z = z.combined46
}
ipp := c.getNetwork00(z.ipV6).ipp
if any := z.ipPrefix2aggregate[ipp]; any != nil {
return any.name
} else {
// Zone with network 0/0 doesn't have an aggregate 0/0.
return z.name
}
}
Expand Down Expand Up @@ -1307,6 +1312,9 @@ func (c *spoc) exportMasterOwner(dir string, masterOwner string) {
func (c *spoc) exportZone2Areas(dir string) {
result := make(jsonMap)
for _, z := range c.allZones {
if z.ipV6 && z.combined46 != nil {
continue
}
var l stringList
a := z.inArea
for a != nil {
Expand Down
25 changes: 24 additions & 1 deletion go/testdata/export-netspoc/combined46.t
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,27 @@ service:s1 = {
"any:n2-v6"
]
}
=END=
=END=

############################################################
=TITLE=Show v4 areas for combined zone
=INPUT=
area:all-v4 = { anchor = network:n1; ipv4_only; }
area:all-v6 = { anchor = network:n1; ipv6_only; }
area:a1-v4 = { border = interface:r1.n1; ipv4_only; }

network:n1 = { ip = 10.1.1.0/24; ip6 = 2001:db8:1:1::/64; }
network:n2 = { ip6 = 2001:db8:1:2::/64; }
router:r1 = {
managed;
model = ASA;
interface:n1 = { ip = 10.1.1.1; ip6 = 2001:db8:1:1::1; hardware = n1; }
interface:n2 = { ip6 = 2001:db8:1:2::1; hardware = n2; }
}
=OUTPUT=
--zone2areas
{
"any:[network:n1]": [ "a1-v4", "all-v4" ],
"any:[network:n2]": [ "all-v6" ]
}
=END=

0 comments on commit 947c0c5

Please sign in to comment.