@@ -8,7 +8,7 @@ extension OnDemandModule {
88 func neRules( _ ctx: PartoutLoggerContext ) -> [ NEOnDemandRule ] {
99 var rules : [ NEOnDemandRule ] = [ ]
1010
11- // apply exceptions (unless .any)
11+ // Apply exceptions (unless .any)
1212 if policy != . any {
1313 if Self . supportsCellular, withMobileNetwork {
1414 if let rule = cellularRule ( ) {
@@ -30,14 +30,13 @@ extension OnDemandModule {
3030 }
3131 }
3232
33- // IMPORTANT: append fallback rule last
33+ // IMPORTANT: Append fallback rule last
3434 rules. append ( globalRule ( ) )
3535
3636 pp_log ( ctx, . os, . info, " On-demand rules: " )
3737 rules. forEach {
3838 pp_log ( ctx, . os, . info, " \( $0) " )
3939 }
40-
4140 return rules
4241 }
4342}
@@ -49,10 +48,14 @@ private extension OnDemandModule {
4948 case . any, . excluding:
5049 rule = NEOnDemandRuleConnect ( )
5150 case . including:
52- rule = NEOnDemandRuleIgnore ( )
51+ rule = NEOnDemandRuleDisconnect ( )
5352 @unknown default :
5453 rule = NEOnDemandRuleConnect ( )
5554 }
55+ // This might be the culprit, WG only matches .wiFi
56+ // IIRC, when .any is set with .including policy (i.e. fall
57+ // back to a disconnect rule), the profile could not
58+ // activate (forcibly disconnected). Maybe only on iOS?
5659 rule. interfaceTypeMatch = . any
5760 return rule
5861 }
@@ -89,7 +92,7 @@ private extension OnDemandModule {
8992
9093 func wifiRule( SSIDs: [ String ] ) -> NEOnDemandRule {
9194 let rule = networkRule ( matchingInterface: . wiFi)
92- rule. ssidMatch = SSIDs . sorted ( ) // for testing
95+ rule. ssidMatch = SSIDs . sorted ( ) // Predictable, for testing
9396 return rule
9497 }
9598}
0 commit comments