From 1a20188c0dc0ba9bd8e3a2841b5283845d79a6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 7 Oct 2023 13:58:40 +0300 Subject: [PATCH] Improve 169.254.0.0/16 SSDP broadcast avoidance check (#264) It was unnecessarily using a regular expression, and in suspiciously glob-style manner. Co-authored-by: Oliver <10700296+ol-iver@users.noreply.github.com> --- denonavr/ssdp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/denonavr/ssdp.py b/denonavr/ssdp.py index 276a394..4735b4d 100755 --- a/denonavr/ssdp.py +++ b/denonavr/ssdp.py @@ -134,7 +134,7 @@ async def async_send_ssdp_broadcast() -> Set[str]: async def async_send_ssdp_broadcast_ip(ip_addr: str) -> Set[str]: """Send SSDP broadcast messages to a single IP.""" # Ignore 169.254.0.0/16 addresses - if re.search("169.254.*.*", ip_addr): + if ip_addr.startswith("169.254."): return set() # Prepare socket