Post

Replies

Boosts

Views

Activity

How to pass parameter in Swift Async call
How to pass a parameter to an async call in swift. In a function when i try to pass a stack local auto variable to an async block, in some scenario I could see the passed parameter has changed in below code. The possible reason I could think of is that as soon as the function (handleNewFlow) is returned, the stack memory location (for supportedFlow) is freed to be taken by other functions: // The TCP flows are actually run through the flow copying process   override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool {     // See the doc comment for `canHandleNewFlow(_:)` for an explanation of     // why the code below is structured this way.     let (supportedFlow, proxyServer, proxyPort, shouldBlock) = self.core.supportedFlowForFlow(flow, remote_endpoint: nil )     // os_log(.debug, log: self.log, "Provider did handle flow with server :: %{public}@ and port :: %{public}@", proxyServer!, proxyPort!)     if (supportedFlow != nil) {       self.queue.async {         if (shouldBlock == true) {           // TODO with proper handling of flow           os_log(.debug, log: self.log, "TransparentProxy Provider want to block this TCP flow, flow: 0x%zx", flow.osLogID)           let error = NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey : "Connection Refused"])           flow.closeReadWithError(error)           flow.closeWriteWithError(error)                     } else {           self.core.handleNewSupportedFlow(supportedFlow!, proxyServer!, proxyPort!)         }       }       os_log(.debug, log: self.log, "Provider did handle new flow, flow: 0x%zx", flow.osLogID)       return true     } else {       os_log(.debug, log: self.log, "Provider did not handle new flow, flow: 0x%zx", flow.osLogID)       return false     }   } In above code I could see the value 'supportedFlow' is not correct always when 'self.core.handleNewSupportedFlow()' is called:           self.core.handleNewSupportedFlow(supportedFlow!, proxyServer!, proxyPort!) Can someone help me in passing 'supportedFlow' as thread function parameter in async block?
1
0
1.3k
Sep ’22
Difference between PacketTunnelProvider and utun
I am trying to find the available methods to capture selective IP traffic to tunnel it using an UDP tunneling. I went through the online resources and found that we can achieve this using PacketTunnelProvider where we will configure the tunnel then define inbound and outbound reader and writer functions. One another method I found where we open a utun socket, assign source and destination tunnel address of the tunnel endpoints and then start doing read write operations on the utun interface, where our application will be able to read any traffic coming to that interface. (also we need to configure appropriate routes for the utun interface to redirect traffic). I wanted to understand the difference between the two methods, and in which scenario both should be used?
7
0
2.6k
Jul ’22
How to avoid user consent while uninstalling system extension
While uninstalling system extension, user gets a pop for user consent and ask to enter administrator credential to allow the uninstallation. We couldnt find a method to avoid this user consent and allow system extension removal silently. This is becoming an issue for one of our customer. On the other had System Extension installation can be handled silently using MDM profiles. Can you please suggest a method to allow silent uninstallation of system extension?
4
0
1k
Nov ’21
How to pass parameter in Swift Async call
How to pass a parameter to an async call in swift. In a function when i try to pass a stack local auto variable to an async block, in some scenario I could see the passed parameter has changed in below code. The possible reason I could think of is that as soon as the function (handleNewFlow) is returned, the stack memory location (for supportedFlow) is freed to be taken by other functions: // The TCP flows are actually run through the flow copying process   override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool {     // See the doc comment for `canHandleNewFlow(_:)` for an explanation of     // why the code below is structured this way.     let (supportedFlow, proxyServer, proxyPort, shouldBlock) = self.core.supportedFlowForFlow(flow, remote_endpoint: nil )     // os_log(.debug, log: self.log, "Provider did handle flow with server :: %{public}@ and port :: %{public}@", proxyServer!, proxyPort!)     if (supportedFlow != nil) {       self.queue.async {         if (shouldBlock == true) {           // TODO with proper handling of flow           os_log(.debug, log: self.log, "TransparentProxy Provider want to block this TCP flow, flow: 0x%zx", flow.osLogID)           let error = NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey : "Connection Refused"])           flow.closeReadWithError(error)           flow.closeWriteWithError(error)                     } else {           self.core.handleNewSupportedFlow(supportedFlow!, proxyServer!, proxyPort!)         }       }       os_log(.debug, log: self.log, "Provider did handle new flow, flow: 0x%zx", flow.osLogID)       return true     } else {       os_log(.debug, log: self.log, "Provider did not handle new flow, flow: 0x%zx", flow.osLogID)       return false     }   } In above code I could see the value 'supportedFlow' is not correct always when 'self.core.handleNewSupportedFlow()' is called:           self.core.handleNewSupportedFlow(supportedFlow!, proxyServer!, proxyPort!) Can someone help me in passing 'supportedFlow' as thread function parameter in async block?
Replies
1
Boosts
0
Views
1.3k
Activity
Sep ’22
Difference between PacketTunnelProvider and utun
I am trying to find the available methods to capture selective IP traffic to tunnel it using an UDP tunneling. I went through the online resources and found that we can achieve this using PacketTunnelProvider where we will configure the tunnel then define inbound and outbound reader and writer functions. One another method I found where we open a utun socket, assign source and destination tunnel address of the tunnel endpoints and then start doing read write operations on the utun interface, where our application will be able to read any traffic coming to that interface. (also we need to configure appropriate routes for the utun interface to redirect traffic). I wanted to understand the difference between the two methods, and in which scenario both should be used?
Replies
7
Boosts
0
Views
2.6k
Activity
Jul ’22
How to disable disconnect option for App Proxy VPN
AppProxy VPN can be disconnected by using "Disconnect" option in Network settings. How can I disable the 'Disconnect' button for the VPN in network settings? Current this can be disabled even without opening the lock (bottom). Or Can we somehow disable the effect of the disconnect action, ie user cannot stop VPN from this place?
Replies
5
Boosts
0
Views
1.1k
Activity
Nov ’21
How to avoid user consent while uninstalling system extension
While uninstalling system extension, user gets a pop for user consent and ask to enter administrator credential to allow the uninstallation. We couldnt find a method to avoid this user consent and allow system extension removal silently. This is becoming an issue for one of our customer. On the other had System Extension installation can be handled silently using MDM profiles. Can you please suggest a method to allow silent uninstallation of system extension?
Replies
4
Boosts
0
Views
1k
Activity
Nov ’21