pulb/mailnag — Issue #27: ping test for network connectivity is unreliable
Author: nocnokneo
Created: 2011-12-02 15:04:13+00:00
State: open

Does not work with a LAN-only connection, ICMP-blocking firewall, etc...

Consider looking at NetworkManager connection state (org.freedesktop.NetworkManager.Connection.Active). Here's a python example:

www.puyb.net/download/OpenWifiAutoConnect.py

As a *fallback* for non-NetworkManager-managed systems you could do a ping test. But ping one of the /etc/resolv.conf name servers or test that you can open a TCP connection to one of the user's configured mailservers.