From 120dc491c492ea5bf55d1cc0b40348cf7704c64f Mon Sep 17 00:00:00 2001 From: Francesco Tamagni Date: Tue, 20 Aug 2024 15:06:57 +0200 Subject: [PATCH] tunnel-interface-observer: Fix start() crash on i/tvOS When SCDynamicStoreCopyKeyList() fails. --- lib/netif/tunnel-interface-observer.vala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/netif/tunnel-interface-observer.vala b/lib/netif/tunnel-interface-observer.vala index fb8fd2232..073ec42d7 100644 --- a/lib/netif/tunnel-interface-observer.vala +++ b/lib/netif/tunnel-interface-observer.vala @@ -30,11 +30,16 @@ public class Frida.TunnelInterfaceObserver : Object, DynamicInterfaceObserver { context.info = this; store = new Darwin.SystemConfiguration.DynamicStore (null, CoreFoundation.String.make ("Frida"), on_interfaces_changed_wrapper, context); + var pattern = CoreFoundation.String.make ("State:/Network/Interface/utun.*/IPv6"); var patterns = new CoreFoundation.Array (null, ((CoreFoundation.Type[]) &pattern)[:1]); store.set_notification_keys (null, patterns); + store.set_dispatch_queue (event_queue); - handle_interface_changes (store.copy_key_list (pattern)); + + var initial_keys = store.copy_key_list (pattern); + if (initial_keys != null) + handle_interface_changes (initial_keys); } private static void on_interfaces_changed_wrapper (Darwin.SystemConfiguration.DynamicStore store,