Check for mq before attempting to delete https://github.com/LibreQoE/LibreQoS/issues/228

This commit is contained in:
Robert Chacón 2023-03-24 16:41:34 -06:00 committed by GitHub
parent 1c4b9a7666
commit 549772e3db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,17 +46,14 @@ def shell(command):
else:
logging.info(command)
def shellTC(command):
def shellReturn(command):
returnableString = ''
if enableActualShellCommands:
print(command)
commands = command.split(' ')
proc = subprocess.Popen(commands, stdout=subprocess.PIPE)
for line in io.TextIOWrapper(proc.stdout, encoding="utf-8"): # or another encoding
if logging.DEBUG <= logging.root.level:
print(line)
if ("RTNETLINK answers" in line) or ("We have an error talking to the kernel" in line):
warnings.warn("Command: '" + command + "' resulted in " + line, stacklevel=2)
raise SystemError("Command: '" + command + "' resulted in " + line)
returnableString = returnableString + line + '\n'
return returnableString
def checkIfFirstRunSinceBoot():
if os.path.isfile("lastRun.txt"):
@ -75,14 +72,14 @@ def checkIfFirstRunSinceBoot():
def clearPriorSettings(interfaceA, interfaceB):
if enableActualShellCommands:
# Clear tc filter
if OnAStick == True:
shell('tc qdisc delete dev ' + interfaceA + ' root')
else:
shell('tc qdisc delete dev ' + interfaceA + ' root')
shell('tc qdisc delete dev ' + interfaceB + ' root')
#shell('tc qdisc delete dev ' + interfaceA)
#shell('tc qdisc delete dev ' + interfaceB)
if 'mq' in shellReturn('tc qdisc show dev ' + interfaceA + ' root'):
print('MQ detected. Will delete and recreate mq qdisc.')
# Clear tc filter
if OnAStick == True:
shell('tc qdisc delete dev ' + interfaceA + ' root')
else:
shell('tc qdisc delete dev ' + interfaceA + ' root')
shell('tc qdisc delete dev ' + interfaceB + ' root')
def tearDown(interfaceA, interfaceB):
# Full teardown of everything for exiting LibreQoS