mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -07:00
fix: do not report a routing error if the interface is disconnected
This commit is contained in:
parent
2d03782fe1
commit
23e074b686
1 changed files with 5 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/bettercap/bettercap/v2/network"
|
||||
"github.com/bettercap/bettercap/v2/routing"
|
||||
"github.com/evilsocket/islazy/log"
|
||||
"github.com/evilsocket/islazy/ops"
|
||||
)
|
||||
|
||||
type gateway struct {
|
||||
|
@ -51,7 +52,10 @@ func (s *Session) routeMon() {
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
s.Events.Log(log.ERROR, "error getting ipv4 gateway: %v", err)
|
||||
s.Events.Log(
|
||||
ops.Ternary(err == network.ErrNoGateway, log.DEBUG, log.ERROR).(log.Verbosity),
|
||||
"error getting ipv4 gateway: %v",
|
||||
err)
|
||||
} else {
|
||||
if gw4now.IpAddress != gw4.IpAddress || gw4now.HwAddress != gw4.HwAddress {
|
||||
s.Events.Add("gateway.change", GatewayChange{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue