Change dhcp internal index to use mac address (#126573)

This commit is contained in:
J. Nick Koston 2024-09-24 01:58:32 -05:00 committed by GitHub
parent 2df6824856
commit 615ec548db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -213,19 +213,20 @@ class WatcherBase:
# and since all consumers of this data are expecting it to be
# formatted without colons we will continue to do so
mac_address = formatted_mac.replace(":", "")
compressed_ip_address = made_ip_address.compressed
data = self._address_data.get(ip_address)
data = self._address_data.get(mac_address)
if (
data
and data[MAC_ADDRESS] == mac_address
and data[IP_ADDRESS] == compressed_ip_address
and data[HOSTNAME].startswith(hostname)
):
# If the address data is the same no need
# to process it
return
data = {MAC_ADDRESS: mac_address, HOSTNAME: hostname}
self._address_data[ip_address] = data
data = {IP_ADDRESS: compressed_ip_address, HOSTNAME: hostname}
self._address_data[mac_address] = data
lowercase_hostname = hostname.lower()
uppercase_mac = mac_address.upper()