Comment 8 for bug 1039042

Revision history for this message
Sergio Spinatelli (spinatelli) wrote : Re: Detect captive portals when connecting to WiFi [$25]

I tinkered with this bug a bit, and got a solution that (seems to) work.
It simply consists in keeping the attached script in the /etc/NetworkManager/dispatcher.d directory with execution permissions.
NetworkManager runs all scripts in that directory. What the script does is:
1) check if the event is an "up" event, i.e a new connection
2) test if "http://clients3.google.com/generate_204" returns 204, if not we are in a walled garden
3) if we are in a walled garden, launch the default browser, trying to open google.com, which should then "trigger" the captive portal (uses xdg-open, is it actually the best way to open a link in the default browser?)

What do you think?