diff mbox

pktgen and tos

Message ID CAHA+R7OKfg5C2dEz2JuxWncoo8gBX=r2MuHUdsGvALNXRSQoiQ@mail.gmail.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Cong Wang Aug. 21, 2014, 3:05 a.m. UTC
On Wed, Aug 20, 2014 at 2:52 PM, Ben Greear <greearb@candelatech.com> wrote:
> Here's a half-arsed bug report, in case someone is bored.
>
> At least in my hacked up pktgen, you cannot set a one-digit tos,
> because the parser fails if length is not 2 digits.
>
> echo tos 4 > /proc/net/pktgen/rddVR2 && cat /proc/net/pktgen/rddVR2
>
> ...
> Result: ERROR: tos must be 00-ff
>
> If you use '04' instead, it works.  In my case, it will be easier to hack
> user-space
> to deal with this than fix pktgen, but I thought someone might want to fix
> it proper.
>
> Also, could be that upstream code doesn't have this limitation...

We need something like this:

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 8b849dd..f8cb428 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1674,7 +1674,7 @@  static ssize_t pktgen_if_write(struct file *file,
  return len;

  i += len;
- if (len == 2) {
+ if (len <= 2) {
  pkt_dev->tos = tmp_value;
  sprintf(pg_result, "OK: tos=0x%02x", pkt_dev->tos);
  } else {