Skip to contentSkip to conversation

pktgen and tos

DISCUSSION Ben Greear 2 participants 2 messages Aug 20, 2014 – Aug 21, 2014

Subsystems (2)
lore
Share & tools
lore

Ben Greear

author
#0 lore raw

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

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#1 lore raw
Quoted 10 lines · Ben Greear

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

Quoted 6 lines

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:

net/core/pktgen.c +1 -1
index 8b849dd..f8cb428 100644
@@ -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 {