Skip to content

Commit

Permalink
tunnel-interface-observer: Fix start() crash on i/tvOS
Browse files Browse the repository at this point in the history
When SCDynamicStoreCopyKeyList() fails.
  • Loading branch information
mrmacete authored and oleavr committed Aug 20, 2024
1 parent 2ebec1a commit 120dc49
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/netif/tunnel-interface-observer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 120dc49

Please sign in to comment.