Skip to content

Commit

Permalink
cidata: Use mac address as dhcpd identifier
Browse files Browse the repository at this point in the history
On macOS the DHCP server use the DUID+IAID for both hw_address and
identifier, which makes it harder to discover the machine mac address by
looking up leases in /var/db/dhcpd_leases. It seems that this issue
started in macOS 15.

    % cat /var/db/dhcpd_leases
    {
            name=lima-test
            ip_address=192.168.105.4
            hw_address=ff,5c:bb:eb:5e:0:2:0:0:ab:11:72:3e:92:23:14:1d:a7:ba
            identifier=ff,5c:bb:eb:5e:0:2:0:0:ab:11:72:3e:92:23:14:1d:a7:ba
            lease=0x678b8aee
    }

With this change the record is created using the mac address:

    % cat /var/db/dhcpd_leases
    {
            name=lima-test
            ip_address=192.168.105.4
            hw_address=1,52:55:55:ba:82:85
            identifier=1,52:55:55:ba:82:85
            lease=0x678b90c6
    }

The fix is based on:
cirruslabs/linux-image-templates#39.

Minikube have the similar (networkd specific) fix:
kubernetes/minikube#3572

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs committed Jan 18, 2025
1 parent 9248baf commit 99870e4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cidata/cidata.TEMPLATE.d/network-config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ethernets:
set-name: {{$nw.Interface}}
dhcp4-overrides:
route-metric: {{$nw.Metric}}
dhcp-identifier: mac
{{- if and (eq $nw.Interface $.SlirpNICName) (gt (len $.DNSAddresses) 0) }}
nameservers:
addresses:
Expand Down

0 comments on commit 99870e4

Please sign in to comment.