diff --git a/src/data/hassio/network.ts b/src/data/hassio/network.ts index afe8b920f7d7..51cd6b8e3730 100644 --- a/src/data/hassio/network.ts +++ b/src/data/hassio/network.ts @@ -117,11 +117,10 @@ export const accesspointScan = async ( }; export const parseAddress = (address: string) => { - const isIPv6 = address.includes(":"); - const [ip, cidr] = address.includes("/") - ? address.split("/") - : [address, isIPv6 ? "64" : "24"]; - return { ip, mask: cidrToNetmask(cidr, isIPv6) }; + const [ip, cidr] = address.split("/"); + const isIPv6 = ip.includes(":"); + const mask = cidr ? cidrToNetmask(cidr, isIPv6) : null; + return { ip, mask }; }; export const formatAddress = (ip: string, mask: string) => diff --git a/src/panels/config/network/supervisor-network.ts b/src/panels/config/network/supervisor-network.ts index 22b23188c6c9..719244c40881 100644 --- a/src/panels/config/network/supervisor-network.ts +++ b/src/panels/config/network/supervisor-network.ts @@ -656,8 +656,10 @@ export class HassioNetwork extends LitElement { if (id === "address") { const index = (ev.target as any).index as number; const { mask } = parseAddress(value); - this._interface[version]!.address![index] = formatAddress(value, mask); - this.requestUpdate("_interface"); + if (mask) { + this._interface[version]!.address![index] = formatAddress(value, mask); + this.requestUpdate("_interface"); + } } else if (id === "netmask") { const index = (ev.target as any).index as number; const { ip } = parseAddress(this._interface![version]!.address![index]);