Commit 4d9a264f authored by Florian Westphal's avatar Florian Westphal Committed by Stephen Hemminger

utils: relax strtoX checking in get_time_rtt

ip route change dev tap0 192.168.7.0/24 rto_min 1ms
Error: argument "1ms" is wrong: "rto_min" value is invalid

get_time_rtt() checks for 's' or 'msec' and converts to milliseconds
if needed.

Fixes: 697ac639 (utils: fix range checking for get_u32/get_u64 et all)
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
parent e4fc7e26
...@@ -144,8 +144,8 @@ int get_time_rtt(unsigned *val, const char *arg, int *raw) ...@@ -144,8 +144,8 @@ int get_time_rtt(unsigned *val, const char *arg, int *raw)
if (t < 0.0) if (t < 0.0)
return -1; return -1;
/* extra non-digits */ /* no digits? */
if (!p || p == arg || *p) if (!p || p == arg)
return -1; return -1;
/* over/underflow */ /* over/underflow */
...@@ -154,8 +154,8 @@ int get_time_rtt(unsigned *val, const char *arg, int *raw) ...@@ -154,8 +154,8 @@ int get_time_rtt(unsigned *val, const char *arg, int *raw)
} else { } else {
res = strtoul(arg, &p, 0); res = strtoul(arg, &p, 0);
/* empty string or trailing non-digits */ /* empty string? */
if (!p || p == arg || *p) if (!p || p == arg)
return -1; return -1;
/* overflow */ /* overflow */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment