From f1f53b9f24e3255a7646015fa31df1155108b980 Mon Sep 17 00:00:00 2001 From: Petar Petrov Date: Fri, 20 Dec 2024 12:28:12 +0200 Subject: [PATCH] Set default netmask when parsing an address (#23348) --- src/data/hassio/network.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/data/hassio/network.ts b/src/data/hassio/network.ts index 022b47194b94..afe8b920f7d7 100644 --- a/src/data/hassio/network.ts +++ b/src/data/hassio/network.ts @@ -117,8 +117,11 @@ export const accesspointScan = async ( }; export const parseAddress = (address: string) => { - const [ip, cidr] = address.split("/"); - return { ip, mask: cidrToNetmask(cidr, address.includes(":")) }; + const isIPv6 = address.includes(":"); + const [ip, cidr] = address.includes("/") + ? address.split("/") + : [address, isIPv6 ? "64" : "24"]; + return { ip, mask: cidrToNetmask(cidr, isIPv6) }; }; export const formatAddress = (ip: string, mask: string) =>