Skip to content

Commit

Permalink
Use proper variable names, matching its actual content
Browse files Browse the repository at this point in the history
  • Loading branch information
bgandon committed Feb 16, 2024
1 parent 59df032 commit cc658e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/bosh-virtualbox-cpi/vm/network/add_host_only.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ func (n Networks) createHostOnly(gateway, netmask string) (string, error) {
var expectedMatchesLen int

if systemInfo.IsMacOSXVBoxSpecial6or7Case() {
addr := net.ParseIP(netmask).To4()
maskIP := net.ParseIP(netmask).To4()
subnetFirstIP := &net.IPNet{
IP: net.ParseIP(gateway),
Mask: net.IPv4Mask(addr[0], addr[1], addr[2], addr[3]),
Mask: net.IPv4Mask(maskIP[0], maskIP[1], maskIP[2], maskIP[3]),
}
cidrRange, _ := net.IPv4Mask(addr[0], addr[1], addr[2], addr[3]).Size()
_, subnet, err := net.ParseCIDR(fmt.Sprintf("%s/%v", gateway, cidrRange))
maskLength, _ := net.IPv4Mask(maskIP[0], maskIP[1], maskIP[2], maskIP[3]).Size()
_, subnet, _ := net.ParseCIDR(fmt.Sprintf("%s/%v", gateway, maskLength))

lowerIp, err := systemInfo.GetFirstIP(subnetFirstIP)
if err != nil {
Expand Down

0 comments on commit cc658e0

Please sign in to comment.