Suppress reporting useless entries

This commit is contained in:
Mygod
2020-06-28 05:00:53 +08:00
parent e6f72df814
commit 6095185edf

View File

@@ -74,8 +74,9 @@ data class IpNeighbour(val ip: InetAddress, val dev: String, val lladdr: MacAddr
} }
// use ARP as fallback for IPv4, except for INCOMPLETE which by definition does not have arp entry, // use ARP as fallback for IPv4, except for INCOMPLETE which by definition does not have arp entry,
// or for DELETING, which we do not care about MAC not present // or for DELETING, which we do not care about MAC not present
if (ip is Inet4Address && lladdr == MacAddressCompat.ALL_ZEROS_ADDRESS && state != State.INCOMPLETE && if (lladdr == MacAddressCompat.ALL_ZEROS_ADDRESS && state != State.INCOMPLETE &&
state != State.DELETING) try { state != State.DELETING) {
if (ip is Inet4Address) try {
val list = arp() val list = arp()
.asSequence() .asSequence()
.filter { parseNumericAddress(it[ARP_IP_ADDRESS]) == ip && it[ARP_DEVICE] in devs } .filter { parseNumericAddress(it[ARP_IP_ADDRESS]) == ip && it[ARP_DEVICE] in devs }
@@ -94,6 +95,7 @@ data class IpNeighbour(val ip: InetAddress, val dev: String, val lladdr: MacAddr
Timber.d(line) Timber.d(line)
return emptyList() return emptyList()
} }
}
devs.map { IpNeighbour(ip, it, lladdr, state) } devs.map { IpNeighbour(ip, it, lladdr, state) }
} catch (e: Exception) { } catch (e: Exception) {
Timber.w(IllegalArgumentException("Unable to parse line: $line", e)) Timber.w(IllegalArgumentException("Unable to parse line: $line", e))