flutternetwork / WiFiFlutter

Flutter plugin suite for various WiFi services.
https://wifi.flutternetwork.dev
289 stars 179 forks source link

Can't connect to a WiFi network when connected to a VPN #310

Open johnmaguire opened 1 year ago

johnmaguire commented 1 year ago

I'm using wifi_iot. If conected the Nebula VPN app (it's a mesh overlay networking VPN, similar to Tailscale - it is only used to route some private IP addresses, it is not a VPN that connects me to the WAN) I'm unable to connect to a network using wifi_iot.

If I am connected to the VPN then network.connect() fails. This is the only thing I saw in logcat that looked interesting:

2022-11-18 17:59:57.951  1764-2158  ConnectivityService     pid-1764                             D  requestNetwork for uid/pid:10072/24924 activeRequest: null callbackRequest: 4620 [NetworkRequest [ REQUEST id=4620, [ Transports: WIFI Capabilities: NOT_RESTRICTED&TRUSTED&NOT_VPN Specifier: <WifiNetworkSpecifier [, SSID Match pattern=PatternMatcher{LITERAL: GR_F6E08F}, BSSID Match pattern=Pair{00:00:00:00:00:00 00:00:00:00:00:00}, SSID="GR_F6E08F", BSSID=null, band=-1]> Uid: 10072 RequestorUid: 10072 RequestorPkg: me.johnmaguire.photo_sync UnderlyingNetworks: Null] ]] callback flags: 0 order: 2147483647

I'm using a Pixel 6 on Android 13.

daadu commented 1 year ago

I haven't gone through these (connect with VPN enabled) use-case.

I suspect that VPN needs to be configured with WifiNetworkSuggestion.Builder and WifiNetworkSpecifier.Builder. I am busy with other work these days, urge you to look into this yourself. If you come up with something - we can decide how to integrate it into the plugin.