Logo Search packages:      
Sourcecode: wicd version File versions

def wicd::networking::WirelessConnectThread::run (   self  ) 

The main function of the connection thread.

This function performs the necessary calls to connect to the
specified network, using the information provided. The following
indicates the steps taken.
1. Run pre-connection script.
2. Take down the interface and clean up any previous
   connections.
3. Generate a PSK if required and authenticate.
4. Associate with the WAP.
5. Get/set IP address and DNS servers.

Definition at line 625 of file networking.py.

00625                  :
        """ The main function of the connection thread.

        This function performs the necessary calls to connect to the
        specified network, using the information provided. The following
        indicates the steps taken.
        1. Run pre-connection script.
        2. Take down the interface and clean up any previous
           connections.
        3. Generate a PSK if required and authenticate.
        4. Associate with the WAP.
        5. Get/set IP address and DNS servers.

        """
        wiface = self.wiface
        liface = self.liface
        self.is_connecting = True
        
        # Run pre-connection script.
        self.abort_if_needed()
        self.run_script_if_needed(self.before_script, 'pre-connection')
        self.abort_if_needed()
        
        # Dake down interface and clean up previous connections.
        self.put_iface_down(wiface)
        self.abort_if_needed()
        self.release_dhcp_clients(wiface, liface)
        self.reset_ip_addresses(wiface, liface)
        self.stop_dhcp_clients(wiface)
        self.abort_if_needed()
        self.flush_routes(wiface, liface)

        # Generate PSK and authenticate if needed.
        if self.wpa_driver != 'ralink legacy':
            self.generate_psk_and_authenticate(wiface)

        # Put interface up.
        self.abort_if_needed()
        self.SetStatus('configuring_interface')
        self.put_iface_up(wiface)
        self.abort_if_needed()
        
        # Associate.
        wiface.SetMode(self.network['mode'])
        wiface.Associate(self.network['essid'], self.network['channel'],
                         self.network['bssid'])

        # Authenticate after association for Ralink legacy cards.
        if self.wpa_driver == 'ralink legacy':
            if self.network.get('key'):
                wiface.Authenticate(self.network)
                
        # Validate Authentication.
        if self.network.get('enctype'):
            self.SetStatus('validating_authentication')
            if not wiface.ValidateAuthentication(time.time()):
                self.abort_connection('bad_pass')
        self.abort_if_needed()

        # Set up gateway, IP address, and DNS servers.
        self.set_broadcast_address(wiface)
        self.abort_if_needed()
        self.set_ip_address(wiface)
        self.set_dns_addresses()
        
        # Run post-connection script.
        self.abort_if_needed()
        self.run_script_if_needed(self.after_script, 'post-connection')

        self.SetStatus('done')
        print 'Connecting thread exiting.'
        if self.debug:
            print "IP Address is: " + str(wiface.GetIP())
        self.is_connecting = False
    
    def generate_psk_and_authenticate(self, wiface):


Generated by  Doxygen 1.6.0   Back to index