Skip to content

Commit

Permalink
Revert "Use vpnkit socket for the communication between the daemon an…
Browse files Browse the repository at this point in the history
…d the VM on macOS"

This is in preparation for the switch from hyperkit to vfkit, as vfkit
does not currently have vpnkit support.

This reverts commit cf173bc.
  • Loading branch information
cfergeau authored and praveenkumar committed May 4, 2022
1 parent 5565077 commit d718fa0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 34 deletions.
37 changes: 5 additions & 32 deletions cmd/crc/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"os"
"os/signal"
"regexp"
"runtime"
"syscall"
"time"

Expand Down Expand Up @@ -57,7 +56,7 @@ var daemonCmd = &cobra.Command{
virtualNetworkConfig := types.Configuration{
Debug: false, // never log packets
CaptureFile: os.Getenv("CRC_DAEMON_PCAP_FILE"),
MTU: mtu(), // Large packets slightly improve the performance. Less small packets.
MTU: 4000, // Large packets slightly improve the performance. Less small packets.
Subnet: "192.168.127.0/24",
GatewayIP: constants.VSockGateway,
GatewayMacAddress: "5a:94:ef:e4:0c:dd",
Expand Down Expand Up @@ -95,9 +94,6 @@ var daemonCmd = &cobra.Command{
},
},
},
VpnKitUUIDMacAddresses: map[string]string{
"c3d68012-0208-11ea-9fd7-f2189899ab08": "5a:94:ef:e4:0c:ee",
},
Protocol: types.HyperKitProtocol,
}
if config.Get(crcConfig.HostNetworkAccess).AsBool() {
Expand All @@ -113,13 +109,6 @@ var daemonCmd = &cobra.Command{
},
}

func mtu() int {
if runtime.GOOS == "darwin" {
return 1500
}
return 4000
}

func run(configuration *types.Configuration) error {
vsockListener, err := vsockListener()
if err != nil {
Expand Down Expand Up @@ -173,26 +162,10 @@ func run(configuration *types.Configuration) error {
}()

go func() {
if runtime.GOOS == "darwin" {
for {
conn, err := vsockListener.Accept()
if err != nil {
log.Errorf("vpnkit accept error: %s", err)
continue
}
go func() {
if err := vn.AcceptVpnKit(conn); err != nil {
log.Errorf("vpnkit accept error: %s", err)

}
}()
}
} else {
mux := http.NewServeMux()
mux.Handle(types.ConnectPath, vn.Mux())
if err := http.Serve(vsockListener, mux); err != nil {
errCh <- errors.Wrap(err, "virtualnetwork http.Serve failed")
}
mux := http.NewServeMux()
mux.Handle(types.ConnectPath, vn.Mux())
if err := http.Serve(vsockListener, mux); err != nil {
errCh <- errors.Wrap(err, "virtualnetwork http.Serve failed")
}
}()

Expand Down
2 changes: 0 additions & 2 deletions pkg/crc/machine/hyperkit/driver_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ func CreateHost(machineConfig config.MachineConfig) *hyperkit.Driver {
hyperkitDriver.QcowToolPath = filepath.Join(constants.BinDir(), QcowToolCommand)

hyperkitDriver.VMNet = machineConfig.NetworkMode == network.SystemNetworkingMode
hyperkitDriver.VpnKitSock = constants.TapSocketPath
hyperkitDriver.VpnKitUUID = "c3d68012-0208-11ea-9fd7-f2189899ab08"

return hyperkitDriver
}

0 comments on commit d718fa0

Please sign in to comment.