Exemplo n.º 1
0
def connected_timeout(dummy: int) -> None:
    active_ssid: Optional[str]
    active_ssid = nm.get_active_ssid(modemgr.get_state_device("CONNECTED"))
    log.debug("connected_timeout comparing {} to {}".format(
        connection, active_ssid))
    if connection != active_ssid:
        log.warning("Connection lost on timeout")
        dev = modemgr.get_state_device("CONNECTED")
        set_state("CONNECTING", candidate_connections(dev))

    if modemgr.get_mode() == modemgr.MULTI_MODE:
        wpa.check_wpa(modemgr.get_ap_device().Interface)

        active_ssid = nm.get_active_ssid(modemgr.get_state_device("HOTSPOT"))
        if not active_ssid:
            log.warning("Hotspot lost on timeout")
            set_state("HOTSPOT")

        defroute_devname: Optional[str] = routemgr.defroute_dev()
        ap_dev: NetworkManager.Device = modemgr.get_ap_device()
        link_dev: NetworkManager.Device = modemgr.get_link_device()
        if defroute_devname == nm.device_name(ap_dev):
            # default route is bad. Disconnect link and count on state
            # processing to restore
            log.error("AP is holding default route while CONNECTED, kicking")
            nm.disconnect(link_dev)
Exemplo n.º 2
0
def init_nmmon():
    set_device_listeners(
        modemgr.get_ap_device(),
        modemgr.get_link_device()
    )
Exemplo n.º 3
0
 def to_fn():
     ssid = nm.get_active_ssid(modemgr.get_link_device())
     nm.del_connection_by_ssid(ssid)
     states.set_state('HOTSPOT')
     return False
Exemplo n.º 4
0
def run_cmds(cmds):
    linkdev = nm.device_name(modemgr.get_link_device())
    apdev = nm.device_name(modemgr.get_ap_device())
    for cmd in cmds:
        subprocess.call(cmd.format(link=linkdev, ap=apdev), shell=True)
Exemplo n.º 5
0
 def delete_connection(self):
     ssid = nm.get_active_ssid(modemgr.get_link_device())
     nm.del_connection_by_ssid(ssid)
     states.set_state('HOTSPOT')