diff --git a/src/networkmonitor.py b/src/networkmonitor.py index 0cdffaf6..cb39aec4 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