diff --git a/wicd/backends/be-external.py b/wicd/backends/be-external.py index 4d56be1..d6b891c 100644 --- a/wicd/backends/be-external.py +++ b/wicd/backends/be-external.py @@ -31,9 +31,9 @@ class WirelessInterface() -- Control a wireless network interface. # along with this program. If not, see . # -import wicd.misc as misc -import wicd.wnettools as wnettools - +from wicd import misc +from wicd import wnettools +from wicd.wnettools import * import re import os import os.path @@ -78,30 +78,6 @@ auth_pattern = re.compile('.*wpa_state=(.*?)\n', re.I | re.M | re.S) RALINK_DRIVER = 'ralink legacy' -def SetDNS(*args, **kargs): - """ Call the wnettools SetDNS method. """ - return wnettools.SetDNS(*args, **kargs) - -def GetDefaultGateway(*args, **kargs): - """ Call the wnettools GetDefaultGateway method. """ - return wnettools.GetDefaultGateway(*args, **kargs) - -def StopDHCP(*args, **kargs): - """ Call the wnettools StopDHCP method. """ - return wnettools.StopDHCP(*args, **kargs) - -def GetWirelessInterfaces(*args, **kargs): - """ Call the wnettools GetWirelessInterfaces method. """ - return wnettools.GetWirelessInterfaces(*args, **kargs) - -def GetWiredInterfaces(*args, **kargs): - """ Call the wnettools GetWiredInterfaces method. """ - return wnettools.GetWiredInterfaces(*args, **kargs) - -def IsValidWpaSuppDriver(*args, **kargs): - """ Call the wnettools IsValidWpaSuppDrive method. """ - return wnettools.IsValidWpaSuppDriver(*args, **kargs) - def NeedsExternalCalls(*args, **kargs): """ Return True, since this backend using iwconfig/ifconfig. """ return True diff --git a/wicd/backends/be-ioctl.py b/wicd/backends/be-ioctl.py index bfcfece..b930688 100644 --- a/wicd/backends/be-ioctl.py +++ b/wicd/backends/be-ioctl.py @@ -31,9 +31,10 @@ class WirelessInterface() -- Control a wireless network interface. # along with this program. If not, see . # -import wicd.misc as misc -import wicd.wnettools as wnettools -import wicd.wpath as wpath +from wicd import misc +from wicd import wnettools +from wicd import wpath +from wicd.wnettools import * import iwscan import wpactrl @@ -82,29 +83,6 @@ SIOCGMIIPHY = 0x8947 SIOCETHTOOL = 0x8946 SIOCGIFFLAGS = 0x8913 -def SetDNS(*args, **kargs): - """ Call the wnettools SetDNS method. """ - return wnettools.SetDNS(*args, **kargs) - -def GetDefaultGateway(*args, **kargs): - """ Call the wnettools GetDefaultGateway method. """ - return wnettools.GetDefaultGateway(*args, **kargs) - -def StopDHCP(*args, **kargs): - """ Call the wnettools StopDHCP method. """ - return wnettools.StopDHCP(*args, **kargs) - -def GetWirelessInterfaces(*args, **kargs): - """ Call the wnettools GetWirelessInterfaces method. """ - return wnettools.GetWirelessInterfaces(*args, **kargs) - -def GetWiredInterfaces(*args, **kargs): - """ Call the wnettools GetWiredInterfaces method. """ - return wnettools.GetWiredInterfaces(*args, **kargs) - -def IsValidWpaSuppDriver(*args, **kargs): - """ Call the wnettools IsValidWpaSuppDrive method. """ - return wnettools.IsValidWpaSuppDriver(*args, **kargs) def get_iw_ioctl_result(iface, call): """ Makes the given ioctl call and returns the results. diff --git a/wicd/wnettools.py b/wicd/wnettools.py index 421742c..3030b4e 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -47,6 +47,9 @@ blacklist_strict = '!"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ ' blacklist_norm = ";`$!*|><&\\" blank_trans = maketrans("", "") +__all__ = ["SetDNS", "GetDefaultGateway", "GetWiredInterfaces", "StopDHCP", + "GetWirelessInterfaces", "IsValidWpaSuppDriver", "NeedsExternalCalls"] + def _sanitize_string(string): if string: return translate(str(string), blank_trans, blacklist_norm) @@ -483,9 +486,12 @@ class BaseInterface(object): if self.route_cmd and self.flush_tool == misc.ROUTE: cmds = ['%s del default' % self.route_cmd] cmds.append('route del dev %s' % self.iface) - elif self.ip_cmd and self.flush_tool == misc.IP: + elif self.ip_cmd: #cmd = "ip route flush dev " + self.iface cmds = ['%s route flush all' % self.ip_cmd] + else: + print "No flush command available!" + cmds = [] for cmd in cmds: if self.verbose: print cmd misc.Run(cmd)