fix: fixed a bug in net.show.meta which prevented info being printed if the selected ip was the gateway

This commit is contained in:
evilsocket 2019-02-13 10:25:03 +01:00
parent 4eead7eafa
commit 89cccf028a
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -80,6 +80,14 @@ func (lan *LAN) Get(mac string) (*Endpoint, bool) {
lan.Lock()
defer lan.Unlock()
mac = NormalizeMac(mac)
if mac == lan.iface.HwAddress {
return lan.iface, true
} else if mac == lan.gateway.HwAddress {
return lan.gateway, true
}
if e, found := lan.hosts[mac]; found {
return e, true
}
@ -90,6 +98,12 @@ func (lan *LAN) GetByIp(ip string) *Endpoint {
lan.Lock()
defer lan.Unlock()
if ip == lan.iface.IpAddress {
return lan.iface
} else if ip == lan.gateway.IpAddress {
return lan.gateway
}
for _, e := range lan.hosts {
if e.IpAddress == ip {
return e