Skip to content

Commit

Permalink
Set default netmask when parsing an address (#23348)
Browse files Browse the repository at this point in the history
  • Loading branch information
MindFreeze authored Dec 20, 2024
1 parent 49d9c7f commit f1f53b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/data/hassio/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit f1f53b9

Please sign in to comment.