netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pktgen and tos
@ 2014-08-20 21:52 Ben Greear
  2014-08-21  3:05 ` Cong Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Greear @ 2014-08-20 21:52 UTC (permalink / raw)
  To: netdev@vger.kernel.org

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...

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pktgen and tos
  2014-08-20 21:52 pktgen and tos Ben Greear
@ 2014-08-21  3:05 ` Cong Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Cong Wang @ 2014-08-21  3:05 UTC (permalink / raw)
  To: Ben Greear; +Cc: netdev@vger.kernel.org

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:

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 {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-21  3:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 21:52 pktgen and tos Ben Greear
2014-08-21  3:05 ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).