Skip to content

Commit

Permalink
hard coded mac on user networking
Browse files Browse the repository at this point in the history
  • Loading branch information
jdork0 committed Mar 14, 2023
1 parent cf71121 commit 9bbc78a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 4 additions & 6 deletions usernet/usernet.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ func StartUserNet(sockFD int32, portForwards string) {
GatewayVirtualIPs: []string{"172.16.10.254"},
Protocol: types.BessProtocol,
}
// Forwards: map[string]string{
// fmt.Sprintf("127.0.0.1:%d", sshPort): "172.16.10.2:22",
// },

// shush go
// try to turn off golang logging
// some still sneaking through
null, _ := os.Open(os.DevNull)
os.Stdout = null
os.Stderr = null
Expand All @@ -77,13 +75,14 @@ func StartUserNet(sockFD int32, portForwards string) {
// create a background context
ctx := context.Background()

// get a file connection to the fd pass in
// get a file connection to the socket file descriptor
file := os.NewFile(uintptr(sockFD), "server")
conn, err := net.FileConn(file)
if err != nil {
fmt.Printf("err: %q\n", err)
}

// connect the socket to the virtualnetwork
groupErrs, ctx := errgroup.WithContext(ctx)
groupErrs.Go(func() error {
return vn.AcceptBess(ctx, conn)
Expand All @@ -94,5 +93,4 @@ func StartUserNet(sockFD int32, portForwards string) {
fmt.Printf("virtual network error: %q\n", err)
}
}()
// return nil
}
4 changes: 4 additions & 0 deletions vzcli/CommonVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ class CommonVM: NSObject, NSApplicationDelegate, VZVirtualMachineDelegate {

// connect second socket as vm device
let socketDev = VZFileHandleNetworkDeviceAttachment(fileHandle: FileHandle(fileDescriptor: socket_pair[1]))
// hard code the mac address on this connection
// should probably block two "user" type interfaces on same VM
let vzMac = VZMACAddress(string: "5a:ca:b5:c7:1b:e7")!
networkDevice.macAddress = vzMac
networkDevice.attachment = socketDev

case "nat":
Expand Down

0 comments on commit 9bbc78a

Please sign in to comment.