Prevent Netgear SSDP from updating host (#71240)

pull/71251/head^2
starkillerOG 2022-05-03 19:38:20 +02:00 committed by GitHub
parent 8d40d9df85
commit 0580803b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,7 @@ from homeassistant.const import (
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from homeassistant.util.network import is_ipv4_address
from .const import ( from .const import (
CONF_CONSIDER_HOME, CONF_CONSIDER_HOME,
@ -129,6 +130,9 @@ class NetgearFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
hostname = cast(str, hostname) hostname = cast(str, hostname)
updated_data[CONF_HOST] = hostname updated_data[CONF_HOST] = hostname
if not is_ipv4_address(str(hostname)):
return self.async_abort(reason="not_ipv4_address")
_LOGGER.debug("Netgear ssdp discovery info: %s", discovery_info) _LOGGER.debug("Netgear ssdp discovery info: %s", discovery_info)
await self.async_set_unique_id(discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL]) await self.async_set_unique_id(discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL])