mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-23 01:27:13 +02:00
cmd/cli: only list physical interfaces when listing
Since these are the interfaces that ctrld will manipulate anyway. While at it, also skipping non-working devices on MacOS, by checking if the device is present in network service order
This commit is contained in:
+5
-2
@@ -1119,7 +1119,7 @@ func canBeLocalUpstream(addr string) bool {
|
||||
func withEachPhysicalInterfaces(excludeIfaceName, context string, f func(i *net.Interface) error) {
|
||||
validIfacesMap := validInterfacesMap()
|
||||
netmon.ForeachInterface(func(i netmon.Interface, prefixes []netip.Prefix) {
|
||||
// Skip loopback/virtual interface.
|
||||
// Skip loopback/virtual/down interface.
|
||||
if i.IsLoopback() || len(i.HardwareAddr) == 0 {
|
||||
return
|
||||
}
|
||||
@@ -1128,9 +1128,12 @@ func withEachPhysicalInterfaces(excludeIfaceName, context string, f func(i *net.
|
||||
return
|
||||
}
|
||||
netIface := i.Interface
|
||||
if err := patchNetIfaceName(netIface); err != nil {
|
||||
if patched, err := patchNetIfaceName(netIface); err != nil {
|
||||
mainLog.Load().Debug().Err(err).Msg("failed to patch net interface name")
|
||||
return
|
||||
} else if !patched {
|
||||
// The interface is not functional, skipping.
|
||||
return
|
||||
}
|
||||
// Skip excluded interface.
|
||||
if netIface.Name == excludeIfaceName {
|
||||
|
||||
Reference in New Issue
Block a user