diff --git a/src/opnsense/scripts/dhcp/dnsmasq_watcher.py b/src/opnsense/scripts/dhcp/dnsmasq_watcher.py index 2e9e6f2a7..62c181bcd 100755 --- a/src/opnsense/scripts/dhcp/dnsmasq_watcher.py +++ b/src/opnsense/scripts/dhcp/dnsmasq_watcher.py @@ -58,7 +58,7 @@ def run_watcher(target_filename, default_domain, watch_file, service_pid): for lease in dhcpdleases.watch(): if 'ends' in lease and lease['ends'] > time.time() \ and 'client-hostname' in lease and 'address' in lease and lease['client-hostname']: - if all(hostname_pattern.match(part) for part in lease['client-hostname'].strip().split('.')): + if all(hostname_pattern.match(part) for part in lease['client-hostname'].strip('.').split('.')): address = ipaddress.ip_address(lease['address']) lease['domain'] = default_domain cached_leases[lease['address']] = lease diff --git a/src/opnsense/scripts/dhcp/unbound_watcher.py b/src/opnsense/scripts/dhcp/unbound_watcher.py index 20376501b..e56b59f95 100755 --- a/src/opnsense/scripts/dhcp/unbound_watcher.py +++ b/src/opnsense/scripts/dhcp/unbound_watcher.py @@ -145,7 +145,7 @@ def run_watcher(target_filename, default_domain, watch_file, config): for lease in dhcpdleases.watch(): if 'ends' in lease and lease['ends'] > time.time() \ and 'client-hostname' in lease and 'address' in lease and lease['client-hostname']: - if all(hostname_pattern.match(part) for part in lease['client-hostname'].strip().split('.')): + if all(hostname_pattern.match(part) for part in lease['client-hostname'].strip('.').split('.')): address = ipaddress.ip_address(lease['address']) lease['domain'] = default_domain for lease_config in lease_configs: