]> www.infradead.org Git - users/dwmw2/linux.git/commit
net: pktgen: fix 'rate 0' error handling (return -EINVAL)
authorPeter Seiderer <ps.report@gmx.net>
Wed, 19 Feb 2025 08:45:24 +0000 (09:45 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 21 Feb 2025 01:24:56 +0000 (17:24 -0800)
commit3ba38c25a8c03b77ed448220a6c93dd5552a264e
tree9c6b455b76b56dd4ac1d08c473da978256ecd230
parentb38504346a2400c822cc57d0164521405fb12757
net: pktgen: fix 'rate 0' error handling (return -EINVAL)

Given an invalid 'rate' command e.g. 'rate 0' the return value is '1',
leading to the following misleading output:

- the good case

$ echo "rate 100" > /proc/net/pktgen/lo\@0
$ grep "Result:" /proc/net/pktgen/lo\@0
Result: OK: rate=100

- the bad case (before the patch)

$ echo "rate 0" > /proc/net/pktgen/lo\@0"
-bash: echo: write error: Invalid argument
$ grep "Result:" /proc/net/pktgen/lo\@0
Result: No such parameter "ate"

- with patch applied

$ echo "rate 0" > /proc/net/pktgen/lo\@0
-bash: echo: write error: Invalid argument
$ grep "Result:" /proc/net/pktgen/lo\@0
Result: Idle

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250219084527.20488-5-ps.report@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/pktgen.c