1
0
mirror of https://github.com/gryf/wicd.git synced 2026-03-08 10:35:47 +01:00

Make sure we try each external app in order if selection is set to be automatic.

This commit is contained in:
Dan O'Reilly
2009-02-03 19:35:57 -05:00
parent b54dbcff92
commit 11c1c48b92
3 changed files with 12 additions and 15 deletions

View File

@@ -194,10 +194,10 @@ class WiredInterface(Interface, wnettools.BaseWiredInterface):
except (IOError, ValueError, TypeError): except (IOError, ValueError, TypeError):
print 'Error checking link using /sys/class/net/%s/carrier' % self.iface print 'Error checking link using /sys/class/net/%s/carrier' % self.iface
if self.miitool_cmd and self.link_detect == misc.MIITOOL: if self.ethtool_cmd and self.link_detect in [misc.ETHTOOL, misc.AUTO]:
return self._mii_get_plugged_in()
elif self.ethtool_cmd:
return self._eth_get_plugged_in() return self._eth_get_plugged_in()
elif self.miitool_cmd and self.link_detect in [misc.MIITOOL, misc.AUTO]:
return self._mii_get_plugged_in()
else: else:
print 'Error: No way of checking for a wired connection. Make ' + \ print 'Error: No way of checking for a wired connection. Make ' + \
'sure that either mii-tool or ethtool is installed.' 'sure that either mii-tool or ethtool is installed.'

View File

@@ -191,9 +191,9 @@ class WiredInterface(Interface, wnettools.BaseWiredInterface):
""" """
if not self.iface: return False if not self.iface: return False
if self.ethtool_cmd and self.link_detect != misc.MIITOOL: if self.ethtool_cmd and self.link_detect in [misc.ETHTOOL, misc.AUTO]:
return self._eth_get_plugged_in() return self._eth_get_plugged_in()
elif self.miitool_cmd: elif self.miitool_cmd and self.link_detect in [misc.MIITOOL, misc.AUTO]:
return self._mii_get_plugged_in() return self._mii_get_plugged_in()
else: else:
print 'Error: No way of checking for a wired connection. Make \ print 'Error: No way of checking for a wired connection. Make \

View File

@@ -208,16 +208,13 @@ class BaseInterface(object):
""" """
def get_client_name(cl): def get_client_name(cl):
""" Converts the integer value for a dhcp client to a string. """ """ Converts the integer value for a dhcp client to a string. """
if (cl in [misc.DHCLIENT, "dhclient"] or if self.dhclient_cmd and cl in [misc.DHCLIENT, misc.AUTO]:
(cl == misc.AUTO and self.dhclient_cmd)):
client = "dhclient" client = "dhclient"
cmd = self.dhclient_cmd cmd = self.dhclient_cmd
elif (cl in [misc.DHCPCD, "dhcpcd"] or elif self.dhcpcd_cmd and cl in [misc.DHCPCD, misc.AUTO]:
(cl == misc.AUTO and self.dhcpcd_cmd)):
client = "dhcpcd" client = "dhcpcd"
cmd = self.dhcpcd_cmd cmd = self.dhcpcd_cmd
elif (cl in [misc.PUMP, "pump"] or elif self.pump_cmd and cl in [misc.PUMP, misc.AUTO]:
(cl == misc.AUTO and self.pump_cmd)):
client = "pump" client = "pump"
cmd = self.pump_cmd cmd = self.pump_cmd
else: else:
@@ -482,12 +479,12 @@ class BaseInterface(object):
def FlushRoutes(self): def FlushRoutes(self):
""" Flush all network routes. """ """ Flush all network routes. """
if not self.iface: return False if not self.iface: return False
if self.route_cmd and self.flush_tool == misc.ROUTE: if self.ip_cmd and self.flush_tool in [misc.AUTO, misc.IP]:
cmds = ['%s del default' % self.route_cmd]
cmds.append('route del dev %s' % self.iface)
elif self.ip_cmd:
#cmd = "ip route flush dev " + self.iface #cmd = "ip route flush dev " + self.iface
cmds = ['%s route flush all' % self.ip_cmd] cmds = ['%s route flush all' % self.ip_cmd]
elif self.route_cmd and self.flush_tool in [misc.AUTO, misc.ROUTE]:
cmds = ['%s del default' % self.route_cmd]
cmds.append('route del dev %s' % self.iface)
else: else:
print "No flush command available!" print "No flush command available!"
cmds = [] cmds = []