Post

Replies

Boosts

Views

Activity

Reply to Displaying notifications from NEPacketTunnelProvider
I'm having the same problem -I'm calling requestAuthorization at the containing app, and the user approves notifications.Then at the Extension, I'm calling getNotificationSettings, but the authorizationStatus is notDetermined, and the error is "Notifications are not allowed for this application". Trying to post notifications from the containing app is working fine, but I want to send the notifications from the extension, because the app might be in background mode.Also, looking at the Mac's Notifications Settings, I see that the "Allow Notifications from myApp" is enabled.I tried to test it on several devices - iphone with iOS 13, Mac with macOS 10.14.5 and Mac with macOS 10.15.2.
Jan ’20
Reply to PacketTunnelProvider - display an alert to the user (from Extension)
"Are are you talking about screen lock, that is, the device is awake but the screen is locked / off?" - in this case I think the notification should be shown, doesn't it? Isn't this the default behavior?And as for "device is truly asleep, your code is not running" - when the device is aleep, nothing runs even within the Packet Tunnel Provider? I thought the device do create some traffic even when on sleep mode, to check mails etc..
Dec ’19
Reply to How to debug "Network is unreachable" - Edit: added some details
1. "Adding a exit(0) will terminate your program and I would bet this is not the desired action in this case." - this is not accurate. I'll add the exit(0) only where the user asked to stop the tunnel, so instead of a "clean exit" from the extension, I'll just terminate it.I read here at the forums that this is already acceptible behavior (because of the (knwon) bug that if you are trying to connect shortly after a disconnection, the connection will succeed, but you will get a disconnection after 20 sec).So I'm guessing that using this approch is considered ok, but please correct me if it may cause harm in some way.2. By " capture the incoming "Network is unreachable" error and programmatically force a disconnect on the VPN and then a new connect", you mean something like calling cancelTunnelWithError?3. Thanks for the quick replies!
Dec ’19
Reply to How to debug "Network is unreachable" - Edit: added some details
Thanks. I'm not doing any pre-flight checks for determining the status of the network to setup the VPN tunnel, and regarding the NEOnDemandRuleConnect - I defined a rule to always connect (this is the closest thing to always on). I do have logs at the server, but it seems the client isn't sending any requests. So it's a client issue.However, one of my users described something more specific, and he says it's persistent:He was at the office, connected to the LAN, and the VPN was off.Then he left the office, and walk home. The Mac entered sleep mode.At his home, he opened the Mac and connected to his WIFI. Then he tried to turn on the VPN.The VPN was stuck at 'connecting' phase. He needed to press the disconnect button, and then try reconnecting again. Only then it succeeds.From the logs I saw that when he first clicked the connect button, the error "network is unreachable" appeared.When he pressed the connect button the second time, everything was fine.So I think this is the situation:The VPN protocolConfiguration disconnectOnSleep is set. So when the Mac enters sleep mode, the system calls stopTunnelWithReason. When the Mac awakes, because my OnDemandRules, the OS would start the PacketTunnelProvider again.However, it seems that sometimes in those cases, the network would be unreachable.If I'm right, how can I solve it? And how can I print when the Mac enters sleep mode?
Dec ’19