GIO GNetworkMonitor always reporting the same state
Environment: macOS ventura but receiving same results on Windows and Ubuntu20
When running the following C program
#include <gio/gio.h>
#include <stdio.h>
int main() {
GNetworkMonitor* monitor = g_network_monitor_get_default();
while(1) {
printf("network available: %d \n", g_network_monitor_get_network_available(monitor));
}
}
and then building with gcc -Wall net.c $(pkg-config --libs --cflags gio-2.0) -o main
the result is always 1, even when disconnecting WIFI.
Checking the routing tables on MacOS with netstat -nr | grep default
there is no IP.
default fe80::%utun0 UGcIg utun0
default fe80::%utun1 UGcIg utun1
default fe80::%utun2 UGcIg utun2
When executing the file with G_MESSAGES_DEBUG=all
I get:
(process:3200): GLib-GIO-DEBUG: 16:27:39.791: Failed to initialize portal (GNetworkMonitorPortal) for gio-network-monitor: Not using portals (process:3200): GLib-GIO-DEBUG: 16:27:39.791: _g_io_module_get_default: Found default implementation base (GNetworkMonitorBase) for ?gio-network-monitor?