Module: check_mk
Branch: master
Commit: 196078a81c7f7370063a44c844042260468ac27f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=196078a81c7f73…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 1 13:18:51 2019 +0100
7192 FIX Network scan: Exclude IPv4 addresses that are configured as addition IPv4
addresses
The network scan discovered hosts from IPv4 addresses that are configured as additional
IPv4 addresses for existing hosts. The scan now completely ignores these IPv4 addresses
just like it is done for pirmary IPv4 addresses.
Change-Id: Iedee4253ee9a4e652fb5ecf5cd76ffb3932ccfcd
---
.werks/7192 | 12 ++++++++++++
cmk/gui/watolib/network_scan.py | 14 ++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/.werks/7192 b/.werks/7192
new file mode 100644
index 0000000..1c3ded9
--- /dev/null
+++ b/.werks/7192
@@ -0,0 +1,12 @@
+Title: Network scan: Exclude IPv4 addresses that are configured as addition IPv4
addresses
+Level: 1
+Component: wato
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1551442640
+Class: fix
+
+The network scan discovered hosts from IPv4 addresses that are configured as additional
+IPv4 addresses for existing hosts. The scan now completely ignores these IPv4 addresses
+just like it is done for pirmary IPv4 addresses.
diff --git a/cmk/gui/watolib/network_scan.py b/cmk/gui/watolib/network_scan.py
index 726cdae..fe2c7d0 100644
--- a/cmk/gui/watolib/network_scan.py
+++ b/cmk/gui/watolib/network_scan.py
@@ -162,8 +162,18 @@ def _mask_bits_to_int(n):
# This will not scale well. Do you have a better idea?
def _known_ip_addresses():
- addresses = (host.attribute("ipaddress") for host in
Host.all().itervalues())
- return [address for address in addresses if address]
+ addresses = set()
+
+ for host in Host.all().itervalues():
+ attributes = host.attributes()
+
+ address = attributes.get("ipaddress")
+ if address:
+ addresses.add(address)
+
+ addresses.update(attributes.get("additional_ipv4addresses", []))
+
+ return addresses
def _excludes_by_regexes(addresses, exclude_specs):