1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 20:38:00 +01:00

* Completely reworked the gui/tray system. gui.py and edgy/dapper/tray.py are now all run from the same wicd.py file.

* Added a connection_lost_counter to prevent the wicd frontend from trying to automatically reconnect too quickly if signal strength is briefly lost.
* Added some code to hopefully fix some of the dbus-related encoding problems caused by essids with weird characters.  (Might still need work).
* The tray/gui will now show up in the process manager under the name wicd (along with the wicd icon), instead of just python.
* Added a GetCurrentInterface() method to the daemon that will eventually be used in the VPN plugin.
* Fixed a possible crash caused by signal strength not being returned correctly.
* Split the Wired Profile Chooser from the appGui class, so they are now called separately within wicd.py.  When the profile chooser is called from the daemon, it sets a flag as well as sending a dbus signal, so the chooser will still launch if the wicd frontend isn't running yet.
* Added some docstrings, comments, etc.  Probably a few other small changes I'm forgetting.
This commit is contained in:
imdano
2007-11-18 01:35:35 +00:00
parent 60d6862b3d
commit 8e46a359c1
6 changed files with 919 additions and 354 deletions

View File

@@ -47,6 +47,7 @@ import thread
import misc
import wnettools
import wpath
import os
if __name__ == '__main__':
wpath.chdir(__file__)
@@ -81,7 +82,6 @@ class ConnectThread(threading.Thread):
should_die = False
lock = thread.allocate_lock()
def __init__(self, network, wireless, wired,
before_script, after_script, disconnect_script, gdns1,
gdns2, gdns3):
@@ -290,7 +290,8 @@ class Wireless(Controller):
misc.Run('iptables -N fw-open')
misc.Run('iptables -F fw-interfaces')
misc.Run('iptables -F fw-open')
misc.Run('iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu')
misc.Run('iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS \
--clamp-mss-to-pmtu')
misc.Run('iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT')
misc.Run('iptables -A FORWARD -j fw-interfaces ')
misc.Run('iptables -A FORWARD -j fw-open ')
@@ -298,7 +299,9 @@ class Wireless(Controller):
misc.Run('iptables -P FORWARD DROP')
misc.Run('iptables -A fw-interfaces -i ' + self.wireless_interface + ' -j ACCEPT')
net_ip = '.'.join(ip_parts[0:3]) + '.0'
misc.Run('iptables -t nat -A POSTROUTING -s ' + net_ip + '/255.255.255.0 -o ' + self.wired_interface + ' -j MASQUERADE')
misc.Run('iptables -t nat -A POSTROUTING -s ' + net_ip + \
'/255.255.255.0 -o ' + self.wired_interface + \
' -j MASQUERADE')
misc.Run('echo 1 > /proc/sys/net/ipv4/ip_forward') # Enable routing
@@ -323,8 +326,6 @@ class Wireless(Controller):
wiface.SetAddress('0.0.0.0')
wiface.Down()
class WirelessConnectThread(ConnectThread):
""" A thread class to perform the connection to a wireless network.
@@ -459,8 +460,7 @@ class WirelessConnectThread(ConnectThread):
wiface.StartDHCP()
if ((self.network.get('dns1') or self.network.get('dns2') or
self.network.get('dns3')) and
self.network.get('use_static_dns')):
self.network.get('dns3')) and self.network.get('use_static_dns')):
self.SetStatus('setting_static_dns')
if self.network.get('use_global_dns'):
wnettools.SetDNS(misc.Noneify(self.global_dns_1),
@@ -469,11 +469,11 @@ class WirelessConnectThread(ConnectThread):
else:
wnettools.SetDNS(self.network.get('dns1'),
self.network.get('dns2'), self.network.get('dns3'))
#save as last used profile
# Save as last used profile
print 'Saving last used profile'
config.UnsetLastUsedDefault() # Makes sure there is only one last used profile at a time
self.network.SetWiredProperty("lastused",True)
self.network.SetWiredProperty("lastused", True)
config.SaveWiredNetworkProfile(self.profilename)
#execute post-connection script if necessary
@@ -596,7 +596,7 @@ class WiredConnectThread(ConnectThread):
# Execute pre-connection script if necessary
if self.before_script != '' and self.before_script != None:
print 'executing pre-connectiong script'
print 'executing pre-connection script'
misc.ExecuteScript(self.before_script)
# Put it down
@@ -645,8 +645,7 @@ class WiredConnectThread(ConnectThread):
liface.StartDHCP()
if ((self.network.get('dns1') or self.network.get('dns2') or
self.network.get('dns3')) and
self.network.get('use_static_dns')):
self.network.get('dns3')) and self.network.get('use_static_dns')):
self.SetStatus('setting_static_dns')
if self.network.get('use_global_dns'):
wnettools.SetDNS(misc.Noneify(self.global_dns_1),