mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
fix: protecting concurrent access to LAN hosts
This commit is contained in:
parent
3e8ae0339b
commit
241db0cc66
6 changed files with 43 additions and 23 deletions
|
@ -71,11 +71,12 @@ func (d Discovery) Author() string {
|
|||
func (d *Discovery) runDiff(cache network.ArpTable) {
|
||||
// check for endpoints who disappeared
|
||||
var rem network.ArpTable = make(network.ArpTable)
|
||||
for mac, t := range d.Session.Lan.Hosts {
|
||||
|
||||
d.Session.Lan.EachHost(func(mac string, e *network.Endpoint) {
|
||||
if _, found := cache[mac]; found == false {
|
||||
rem[mac] = t.IpAddress
|
||||
rem[mac] = e.IpAddress
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
for mac, ip := range rem {
|
||||
d.Session.Lan.Remove(ip, mac)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue