Skip to content

Commit

Permalink
network_darwin: Remove dead code
Browse files Browse the repository at this point in the history
This PR removes dead code which also contain `exec.Command` step.
  • Loading branch information
praveenkumar committed Jan 4, 2024
1 parent e4fc918 commit 77c72e7
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions pkg/drivers/vfkit/network_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import (
"bufio"
"fmt"
"io"
"net"
"os"
"os/exec"
"regexp"
"strings"

Expand Down Expand Up @@ -125,20 +123,3 @@ func parseDHCPdLeasesFile(file io.Reader) ([]DHCPEntry, error) {
func trimMACAddress(macAddress string) string {
return leadingZeroRegexp.ReplaceAllString(macAddress, "$1")
}

// GetNetAddr gets the network address for vmnet
func GetNetAddr() (net.IP, error) {
plistPath := VMNetDomain + ".plist"
if _, err := os.Stat(plistPath); err != nil {
return nil, fmt.Errorf("stat: %v", err)
}
out, err := exec.Command("defaults", "read", VMNetDomain, SharedNetAddrKey).Output()
if err != nil {
return nil, err
}
ip := net.ParseIP(strings.TrimSpace(string(out)))
if ip == nil {
return nil, fmt.Errorf("could not get the network address for vmnet")
}
return ip, nil
}

0 comments on commit 77c72e7

Please sign in to comment.