mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
net/interfaces: reduce & cleanup logs on iOS
We don't need a log line every time defaultRoute is read in the good case, and we now only log default interface updates that are actually changes. Updates #3363 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
c8c999d7a9
commit
651c4899ac
@ -21,8 +21,9 @@ func UpdateLastKnownDefaultRouteInterface(ifName string) {
|
|||||||
if ifName == "" {
|
if ifName == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
lastKnownDefaultRouteIfName.Store(ifName)
|
if old := lastKnownDefaultRouteIfName.Swap(ifName); old != ifName {
|
||||||
log.Printf("defaultroute_ios: update from Swift, ifName = %s", ifName)
|
log.Printf("defaultroute_ios: update from Swift, ifName = %s (was %s)", ifName, old)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultRoute() (d DefaultRouteDetails, err error) {
|
func defaultRoute() (d DefaultRouteDetails, err error) {
|
||||||
@ -56,13 +57,13 @@ func defaultRoute() (d DefaultRouteDetails, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !ifc.IsUp() {
|
if !ifc.IsUp() {
|
||||||
log.Println("defaultroute_ios: %s is down", name)
|
log.Printf("defaultroute_ios: %s is down", name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
addrs, _ := ifc.Addrs()
|
addrs, _ := ifc.Addrs()
|
||||||
if len(addrs) == 0 {
|
if len(addrs) == 0 {
|
||||||
log.Println("defaultroute_ios: %s has no addresses", name)
|
log.Printf("defaultroute_ios: %s has no addresses", name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return &ifc
|
return &ifc
|
||||||
@ -76,7 +77,6 @@ func defaultRoute() (d DefaultRouteDetails, err error) {
|
|||||||
if swiftIfName := lastKnownDefaultRouteIfName.Load(); swiftIfName != "" {
|
if swiftIfName := lastKnownDefaultRouteIfName.Load(); swiftIfName != "" {
|
||||||
ifc := getInterfaceByName(swiftIfName)
|
ifc := getInterfaceByName(swiftIfName)
|
||||||
if ifc != nil {
|
if ifc != nil {
|
||||||
log.Printf("defaultroute_ios: using %s (provided by Swift)", ifc.Name)
|
|
||||||
d.InterfaceName = ifc.Name
|
d.InterfaceName = ifc.Name
|
||||||
d.InterfaceIndex = ifc.Index
|
d.InterfaceIndex = ifc.Index
|
||||||
return d, nil
|
return d, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user