Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Softnet solves two problems:
2. DHCP exhaustion
* macOS built-in DHCP-server allocates a `/24` subnet with 86400 seconds lease time by default, which only allows for ~253 VMs a day (or 1 VM every ~6 minutes) to be spawned without causing a denial-of-service, which is pretty limiting for CI services like Cirrus CI

Each VM gets a separate [`vmnet` network](https://developer.apple.com/documentation/vmnet/vmnet_network_create(_:_:)) with a private `/30` subnet selected to avoid overlap with existing host interface subnets. Softnet reserves an IP-address for the VM's MAC-address, delivers it through its own DHCP-server, and uses the reserved address for packet filtering.
Each VM gets a separate [`vmnet` network](https://developer.apple.com/documentation/vmnet/vmnet_network_create(_:_:)) with a private `/29` subnet selected to avoid overlap with existing host interface subnets. Softnet reserves an IP-address for the VM's MAC-address, delivers it through its own DHCP-server, and uses the reserved address for packet filtering.

### Stateful flow authorization

Expand Down
4 changes: 2 additions & 2 deletions lib/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ impl Host {
vm_mac: EthernetAddress,
enable_isolation: bool,
) -> Result<Host> {
// Find an unused /30 subnet for the gateway and VM
let (gateway_ip, vm_ip, subnet) = subnet_finder::find_available_subnet(30)?;
// Find an unused /29 subnet for the gateway and VM
let (gateway_ip, vm_ip, subnet) = subnet_finder::find_available_subnet(29)?;

// Create vmnet's network configuration
let mut configuration = NetworkConfiguration::new(match vm_net_type {
Expand Down
8 changes: 4 additions & 4 deletions lib/subnet_finder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ mod tests {
#[serial_test::serial]
fn finds_two_usable_addresses() {
// Find a subnet on the current host
let (gateway_ip, vm_ip, subnet) = find_available_subnet(30).unwrap();
let (gateway_ip, vm_ip, subnet) = find_available_subnet(29).unwrap();

// Check the subnet and its two usable addresses
assert_eq!(subnet.prefix_len(), 30);
// Check the subnet and its first two usable addresses
assert_eq!(subnet.prefix_len(), 29);
assert!(subnet.network().is_private());
assert_eq!(subnet.hosts().collect::<Vec<_>>(), [gateway_ip, vm_ip]);
assert_eq!(subnet.hosts().collect::<Vec<_>>()[..2], [gateway_ip, vm_ip]);
}
}
Loading