Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_ringparam(interface, args):
try:
ring = ethtool.get_ringparam(interface)
except IOError:
printtab("ring parameters NOT supported on %s!" % interface)
return
changed = False
args = [a.lower() for a in args]
for arg, value in [ ( args[i], args[i + 1] ) for i in range(0, len(args), 2) ]:
if not ethtool_ringparam_map.has_key(arg):
continue
try:
value = int(value)
except:
continue
real_arg = ethtool_ringparam_map[arg]
if ring[real_arg] != value:
ring[real_arg] = value
def show_ring(interface, args = None):
printtab("Ring parameters for %s:" % interface)
try:
ring = ethtool.get_ringparam(interface)
except IOError:
printtab(" NOT supported!")
return
printed = []
for tunable in ethtool_ringparam_msgs:
if len(tunable) == 1:
printtab("%s:" % tunable[0])
else:
printtab("%s %s" % (tunable[0], ring[tunable[1]]))
printed.append(tunable[1])
ringkeys = ring.keys()
if len(ringkeys) != len(printed):
print
for tunable in ringkeys: