diff --git a/scripts/ecnconfig b/scripts/ecnconfig index eceb66831d00..f5ca6635bc2a 100755 --- a/scripts/ecnconfig +++ b/scripts/ecnconfig @@ -106,6 +106,11 @@ class EcnConfig(object): def set_wred_threshold(self, profile, threshold, value): if os.geteuid() != 0: sys.exit("Root privileges required for this operation") + + v = int(value) + if v < 0 : + raise Exception("Invalid %s" % (threshold)) + field = WRED_CONFIG_FIELDS[threshold] if self.verbose: print("Setting %s value to %s" % (field, value)) @@ -114,6 +119,11 @@ class EcnConfig(object): def set_wred_prob(self, profile, drop_color, value): if os.geteuid() != 0: sys.exit("Root privileges required for this operation") + + v = int(value) + if v < 0 or v > 100: + raise Exception("Invalid %s" % (drop_color)) + field = WRED_CONFIG_FIELDS[drop_color] if self.verbose: print("Setting %s value to %s%%" % (field, value))