Fixes bad heuristic when calling "tc show" to check interface; tc sometimes returns stuff

that has more than 12 words in its response. The heuristic is bad, but this at least fixes
the case when tc is returning too much.
This commit is contained in:
Alexander Staubo 2016-07-06 23:15:51 -04:00
parent 4d91f0f763
commit e681002d18

View File

@ -255,7 +255,7 @@ func (t *tcShaper) ReconcileInterface() error {
return t.initializeInterface()
}
fields := strings.Split(output, " ")
if len(fields) != 12 || fields[1] != "htb" || fields[2] != "1:" {
if len(fields) < 12 || fields[1] != "htb" || fields[2] != "1:" {
if err := t.deleteInterface(fields[2]); err != nil {
return err
}