cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.8k stars 112 forks source link

DHCP MAC-address resolver: handle duplicate leases #740

Closed edigaryev closed 7 months ago

edigaryev commented 7 months ago

Before we were trying to handle condition this by filtering out expired leases: https://github.com/cirruslabs/tart/blob/3f17884ac2bdba56f5688537aa6da4d14533e3f4/Sources/tart/MACAddressResolver/Leases.swift#L42-L44

However, it seems that it's possible to have two un-expired leases for the same MAC-address at the same time.

So let's prefer a newer lease over the older one when a duplicate is found.

See https://github.com/cirruslabs/tart/issues/739 for more details.