diff --git a/wicd/backends/be-ioctl.py b/wicd/backends/be-ioctl.py index 08a6a79..b91ac37 100644 --- a/wicd/backends/be-ioctl.py +++ b/wicd/backends/be-ioctl.py @@ -484,7 +484,7 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface): if self.verbose: print cmd misc.Run(cmd) - def GetBSSID(self): + def GetBSSID(self, iwconfig=None): """ Get the MAC address for the interface. """ if not self.iface: return "" data = (self.iface + '\0' * 32)[:32] diff --git a/wicd/gui.py b/wicd/gui.py index 597e781..162cbec 100644 --- a/wicd/gui.py +++ b/wicd/gui.py @@ -527,6 +527,7 @@ class appGui(object): instruct_label = self.wTree.get_widget("label_instructions") if num_networks > 0: instruct_label.show() + dbus_ifaces = dbusmanager.get_dbus_ifaces() for x in range(0, num_networks): if printLine: sep = gtk.HSeparator() @@ -535,7 +536,7 @@ class appGui(object): sep.show() else: printLine = True - tempnet = WirelessNetworkEntry(x, dbusmanager.get_dbus_ifaces()) + tempnet = WirelessNetworkEntry(x, dbus_ifaces) self.network_list.pack_start(tempnet, False, False) tempnet.connect_button.connect("button-press-event", self.connect, "wireless", x, diff --git a/wicd/networking.py b/wicd/networking.py index e1a99f7..b10414b 100644 --- a/wicd/networking.py +++ b/wicd/networking.py @@ -174,16 +174,12 @@ class Controller(object): """ return self.iface.GetIP(ifconfig) - def Disconnect(self): + def Disconnect(self, *args, **kargs): """ Disconnect from the network. """ iface = self.iface if self.disconnect_script != None: - print 'Running wired disconnect script' - iwconfig = self.GetIwconfig() - misc.ExecuteScript(expand_script_macros(self.disconnect_script, 'disconnection', - self.wiface.GetBSSID( iwconfig ), - self.wiface.GetCurrentNetwork( iwconfig ) )) - + print 'Running disconnect script' + misc.ExecuteScript(expand_script_macros(self.disconnect_script, 'disconnection', *args)) iface.ReleaseDHCP() iface.SetAddress('0.0.0.0') iface.Down() @@ -685,7 +681,14 @@ class Wireless(Controller): Resets it's IP address, and puts the interface down then up. """ - Controller.Disconnect(self) + if BACKEND.NeedsExternalCalls(): + iwconfig = self.GetIwconfig() + else: + iwconfig = None + bssid = self.wiface.GetBSSID(iwconfig), + essid = self.wiface.GetCurrentNetwork(iwconfig) + + Controller.Disconnect(self, bssid, essid) self.StopWPA() def SetWPADriver(self, driver): @@ -894,6 +897,9 @@ class Wired(Controller): self.connecting_thread.start() return self.connecting_thread + def Disconnect(self): + Controller.Disconnect(self, 'wired', 'wired') + def DetectWiredInterface(self): """ Attempts to automatically detect a wired interface. """ try: diff --git a/wicd/wnettools.py b/wicd/wnettools.py index 0a4235f..2d6835e 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -483,12 +483,15 @@ class BaseInterface(object): def FlushRoutes(self): """ Flush all network routes. """ if not self.iface: return False - if self.IP_FOUND and self.flush_tool != misc.ROUTE: - cmd = "ip route flush dev " + self.iface + if self.IP_FOUND and self.flush_tool == misc.IP: + #cmd = "ip route flush dev " + self.iface + cmds = ['ip route flush all'] else: - cmd = 'route del dev ' + self.iface - if self.verbose: print cmd - misc.Run(cmd) + cmds = ['route del default'] + cmds.append('route del dev %s' % self.iface) + for cmd in cmds: + if self.verbose: print cmd + misc.Run(cmd) def SetDefaultRoute(self, gw): """ Add a default route with the specified gateway.