@@ -653,6 +653,7 @@ final class RouteManager: ObservableObject {
653653 private func detectVPNViaIfconfig( hintType: VPNType ? ) async -> ( connected: Bool , interface: String ? , type: VPNType ? ) {
654654 guard let result = await runProcessAsync ( " /sbin/ifconfig " , timeout: 5.0 ) else {
655655 // Command failed/timed out - don't change VPN status (return current state)
656+ await MainActor . run { log ( . warning, " ifconfig command failed/timed out " ) }
656657 return ( isVPNConnected, vpnInterface, vpnType)
657658 }
658659
@@ -662,6 +663,7 @@ final class RouteManager: ObservableObject {
662663 var currentInterface : String ?
663664 var hasValidIP = false
664665 var hasUpFlag = false
666+ var debugInfo : [ ( iface: String , ip: String ? , isVPN: Bool , validIP: Bool ) ] = [ ]
665667
666668 for line in output. components ( separatedBy: " \n " ) {
667669 // New interface starts with interface name (no leading whitespace)
@@ -687,7 +689,11 @@ final class RouteManager: ObservableObject {
687689 let parts = trimmed. components ( separatedBy: " " )
688690 if parts. count >= 2 {
689691 let ip = parts [ 1 ]
690- if await isCorporateVPNIP ( ip) {
692+ let isValidCorporateIP = await isCorporateVPNIP ( ip)
693+ if let iface = currentInterface {
694+ debugInfo. append ( ( iface: iface, ip: ip, isVPN: isVPNInterface ( iface) , validIP: isValidCorporateIP) )
695+ }
696+ if isValidCorporateIP {
691697 hasValidIP = true
692698 }
693699 }
@@ -702,6 +708,12 @@ final class RouteManager: ObservableObject {
702708 return ( true , iface, vpnType)
703709 }
704710
711+ // Debug: log what we found
712+ if !debugInfo. isEmpty {
713+ let summary = debugInfo. map { " \( $0. iface) : \( $0. ip ?? " ? " ) vpn= \( $0. isVPN) valid= \( $0. validIP) " } . joined ( separator: " , " )
714+ await MainActor . run { log ( . info, " VPN scan: \( summary) " ) }
715+ }
716+
705717 return ( false , nil , nil )
706718 }
707719
0 commit comments