netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jamal <hadi@cyberus.ca>
To: Ben Greear <greearb@candelatech.com>
Cc: Robert Olsson <Robert.Olsson@data.slu.se>,
	NetDev <netdev@vger.kernel.org>
Subject: Re: pktgen patch available for perusal.
Date: Sat, 04 Nov 2006 13:10:55 -0500	[thread overview]
Message-ID: <1162663855.6237.116.camel@jzny2> (raw)
In-Reply-To: <454CCDE0.5040109@candelatech.com>

On Sat, 2006-04-11 at 09:29 -0800, Ben Greear wrote:
> jamal wrote:
   
> Please do send a script.  I match based on this method below.   Probably 
> you only
> need the part that checks for the MAGIC, 

What i do in my case is send to the SUT to UDP port 9. The SUT loops
back the packet to me after processing and i just have a simple check in
the traffic generator of:

a) Packet = IPV4, IP address matches what i want, port =9, 
b) If this matches i  account and drop it. This means all other traffic
(like ssh etc goes through fine).

I dont really need to check for length because _i know_ udp port 9 to
the SUT is test traffic.

For such a setup, the script would be as simple as (assuming SUT hooked
to eth0):

--
#interested in incoming packets on eth0
tc qdisc add dev eth0 ingress
#interested in packets coming from SUT(10.0.0.21) on UDP port 9
tc filter add dev eth0 parent ffff: protocol ip prio 6 u32 \
match ip src 10.0.0.21/32 \
match udp port 9 0xffff \
flowid 1:16 \
action drop
---

When you do a listing of this filter you will see accounting info.
You list by saying:
---
tc -s filter ls dev eth0 parent ffff:
---

You can ofcourse add many of these based on other header info.

It seems to me your magic header is inside the UDP packet, correct?
In that case you will have to play with matches since you can specify
arbitraty offsets and values inside the packet.

Of course you can do this from your application instead of using tc.
I think that will be the best place to control this and sync with
pktgen sending.

> the rest can be in a method 
> called after you match in your script?
> 

If the packet/byte counters that the drop action provides are not good
enough, you can write yourself a little module that will do the
accounting the way you want it. For example this will be necessary to
the out-of-sequence cheques below. Timestamps are already being updated
Look at net/sched/act_simple.c and its associated user space code in
iproute2.

Now, Ben - are you listening really this time or am i wasting my time
for the nth time giving you all these details? ;->

If you are listening then start with:

1) Do a simple test with just udp traffic as above, doing simple
accounting. This helps you to get a feel on how things work.
2) modify the matching rules to match your magic cookie
3) write a simple action invoked by your matching rules and use tc to
add it to the policy.
4) integrate in your app now that you know what you are doing.

If you follow these steps or a variant-of i will spend time and help.

cheers,
jamal



  reply	other threads:[~2006-11-04 18:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-30 23:47 pktgen patch available for perusal Ben Greear
2006-11-01 17:14 ` Robert Olsson
2006-11-01 19:11   ` Ben Greear
2006-11-03 11:13     ` Robert Olsson
2006-11-03 16:34       ` Ben Greear
2006-11-03 20:24         ` Robert Olsson
2006-11-03 20:41           ` Ben Greear
2006-11-04 12:32     ` jamal
2006-11-04 17:29       ` Ben Greear
2006-11-04 18:10         ` jamal [this message]
2006-11-04 19:12           ` Ben Greear
2006-11-06 14:06           ` Robert Olsson
2006-11-06 14:14     ` Robert Olsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1162663855.6237.116.camel@jzny2 \
    --to=hadi@cyberus.ca \
    --cc=Robert.Olsson@data.slu.se \
    --cc=greearb@candelatech.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).