Exemple #1
0
 def disconnect(self):
     d = self.device.sconn.disconnect_from_internet()
     osobj = get_os_object()
     osobj.delete_default_route(self.iface)
     osobj.delete_dns_info(None, self.iface)
     osobj.configure_iface(self.iface, '', 'down')
     d.addCallback(lambda _: self.Disconnected())
     return d
Exemple #2
0
 def __init__(self):
     name = BusName(consts.WADER_SERVICE, bus=dbus.SystemBus())
     super(StartupController, self).__init__(bus_name=name,
                                     object_path=consts.WADER_OBJPATH)
     from core.oal import get_os_object
     self.hm = get_os_object().hw_manager
     assert self.hm is not None, "Running Wader on an unsupported OS?"
     self.hm.register_controller(self)
Exemple #3
0
    def _set_disconnected(self, force=False):
        if not self.__connected and not force:
            return

        osobj = get_os_object()
        osobj.delete_dns_info(self.dialer.iface)

        self.__connected = False
        self.dialer.Disconnected()
Exemple #4
0
    def _set_connected(self):
        if self.__connected:
            return

        valid, dns = validate_dns(self.dns, self.dialer.conf.staticdns,
                                [self.dialer.conf.dns1, self.dialer.conf.dns2])
        if not valid:
            if self.dialer.conf.staticdns:
                self.dialer.InvalidDNS([])
            else:
                self.dialer.InvalidDNS(self.dns)

        osobj = get_os_object()
        osobj.add_dns_info(dns, self.dialer.iface)

        self.__connected = True
        self.dialer.Connected()
        self.deferred.callback(self.dialer.opath)
Exemple #5
0
    def _generate_wvdial_ppp_options(self):
        if not self.conf.refuse_chap:
            wvdial_ppp_options = CHAP_TEMPLATE
        elif not self.conf.refuse_pap:
            wvdial_ppp_options = PAP_TEMPLATE
        else:
            # this could be a NOOP, but the user might have modified
            # the stock /etc/ppp/peers/wvdial file, so the safest option
            # is to overwrite with our known good options.
            wvdial_ppp_options = DEFAULT_TEMPLATE

        # There are some patched pppd implementations
        # Most systems offer 'replacedefaultroute', but not Fedora
        osobj = get_os_object()
        if hasattr(osobj, 'get_additional_wvdial_ppp_options'):
            wvdial_ppp_options += osobj.get_additional_wvdial_ppp_options()

        save_file(WVDIAL_PPPD_OPTIONS, wvdial_ppp_options)
Exemple #6
0
    def startService(self):
        """Starts the Wader service"""
        log.msg("%s (%s) started" % (consts.APP_NAME, consts.APP_VERSION))

        create_skeleton_and_do_initial_setup()

        # check if we have an OSPlugin for this OS/Distro
        from core.oal import get_os_object
        if get_os_object() is None:
            message = 'OS/Distro not registered'
            details = """
The OS/Distro under which you are running %s is not
registered in the OS database. Check the documentation
for what you can do in order to support your OS/Distro
""" % consts.APP_NAME
            raise SystemExit("%s\n%s" % (message, details))

        from core.dialer import DialerManager
        self.ctrl = StartupController()
        self.dial = DialerManager(self.ctrl)