Skip to content

Commit

Permalink
pktgen: make /proc/net/pktgen/pgctrl report fail on invalid input
Browse files Browse the repository at this point in the history
Giving /proc/net/pktgen/pgctrl an invalid command just returns shell
success and prints a warning in dmesg.  This is not very useful for
shell scripting, as it can only detect the error by parsing dmesg.

Instead return -EINVAL when the command is unknown, as this provides
userspace shell scripting a way of detecting this.

Also bump version tag to 2.75, because (1) reading /proc/net/pktgen/pgctrl
output this version number which would allow to detect this small
semantic change, and (2) because the pktgen version tag have not been
updated since 2010.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jesper Dangaard Brouer authored and David S. Miller committed May 23, 2015
1 parent 2a1ddf2 commit 4020726
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
#include <asm/dma.h>
#include <asm/div64.h> /* do_div */

#define VERSION "2.74"
#define VERSION "2.75"
#define IP_NAME_SZ 32
#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */
#define MPLS_STACK_BOTTOM htonl(0x00000100)
Expand Down Expand Up @@ -512,7 +512,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user *buf,
pktgen_reset_all_threads(pn);

else
pr_warn("Unknown command: %s\n", data);
return -EINVAL;

return count;
}
Expand Down

0 comments on commit 4020726

Please sign in to comment.