From ab845cfce99e6b928fcf11c3dda6cbd03169e3b7 Mon Sep 17 00:00:00 2001 From: Breeze Date: Sat, 8 Aug 2026 16:23:58 +0200 Subject: [PATCH] Handle missing IPv4 netmask during discovery --- src/networkmonitor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/networkmonitor.py b/src/networkmonitor.py index 0cdffaf6f..cb39aec40 100644 --- a/src/networkmonitor.py +++ b/src/networkmonitor.py @@ -166,8 +166,13 @@ def emit_state_changed(self): # TODO: Do this with libnm def same_subnet(self, other_ip_info): if self.current_ip_info.ip4_address is not None and other_ip_info.ip4_address is not None: + netmask = self.current_ip_info.ip4.get("netmask") + if netmask is None: + logging.warning("Discovery: no IPv4 netmask available") + return True + iface = ipaddress.IPv4Interface("%s/%s" % (self.current_ip_info.ip4_address, - self.current_ip_info.ip4["netmask"])) + netmask)) my_net = iface.network