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 # and since all consumers of this data are expecting it to be
# formatted without colons we will continue to do so # formatted without colons we will continue to do so
mac_address = formatted_mac.replace(":", "") 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 ( if (
data data
and data[MAC_ADDRESS] == mac_address and data[IP_ADDRESS] == compressed_ip_address
and data[HOSTNAME].startswith(hostname) and data[HOSTNAME].startswith(hostname)
): ):
# If the address data is the same no need # If the address data is the same no need
# to process it # to process it
return return
data = {MAC_ADDRESS: mac_address, HOSTNAME: hostname} data = {IP_ADDRESS: compressed_ip_address, HOSTNAME: hostname}
self._address_data[ip_address] = data self._address_data[mac_address] = data
lowercase_hostname = hostname.lower() lowercase_hostname = hostname.lower()
uppercase_mac = mac_address.upper() uppercase_mac = mac_address.upper()