Add bridged physical networking via vmnet-helper#1661
Conversation
…lias support Signed-off-by: s3rj1k <evasive.gyron@gmail.com>
| for fd in fds { | ||
| var sendSize = Self.socketSendBufferSize | ||
| var receiveSize = Self.socketReceiveBufferSize | ||
| _ = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sendSize, socklen_t(MemoryLayout<Int32>.size)) |
There was a problem hiding this comment.
We're ignoring the return values on these setsockopt calls (_ = setsockopt(...)). If a system has a restrictive buffer ceiling set via sysctl (kern.ipc.maxsockbuf), the OS will truncate or reject these 1MB/4MB sizes. If that happens, the Virtualization framework might start throwing silent packet drops under high throughput. We should probably log a warning or check the return code here instead of discarding it completely.
| } | ||
|
|
||
| var pollFd = pollfd(fd: fd, events: Int16(POLLIN), revents: 0) | ||
| let timeoutMs = Int32(min(remaining / .milliseconds(1), 1000)) |
There was a problem hiding this comment.
Although this loop runs on a background GCD thread, poll can still lock up the thread for up to a full second per iteration. If the runtime tries to fire a cancel or shutdown signal, it won't be seen until the poll timeout drops, which will lag our teardown. Dropping the timeout value or passing a cancellation token down would make this a lot more responsive.
Add bridged physical networking via vmnet-helper with static IP and alias support
Type of Change
Motivation and Context
I, as a user, would like to have bridge support in containers, this change adds bridge support via external vmnet-helper
Testing