forked from wrenn/wrenn
Cap network slot allocator at 32767 to match veth IP space
The veth addressing uses 10.12.0.0/16 with 2 IPs per slot. At slot index 32768, vethOffset=65536 overflows byte arithmetic and wraps back to 10.12.0.0, causing silent IP collisions with existing sandboxes. Cap the allocator at 32767, which is the actual addressable limit.
This commit is contained in:
@ -24,7 +24,7 @@ func (a *SlotAllocator) Allocate() (int, error) {
|
||||
a.mu.Lock()
|
||||
defer a.mu.Unlock()
|
||||
|
||||
for i := 1; i <= 65534; i++ {
|
||||
for i := 1; i <= 32767; i++ {
|
||||
if !a.inUse[i] {
|
||||
a.inUse[i] = true
|
||||
return i, nil
|
||||
|
||||
Reference in New Issue
Block a user