packet generator
Andrew Gallatin
gallatin at cs.duke.edu
Mon Sep 13 08:55:55 PDT 2004
Don Bowman writes:
> From: owner-freebsd-net at freebsd.org
> > [mailto:owner-freebsd-net at freebsd.org]On Behalf Of Andrew Gallatin
> > Sent: September 10, 2004 19:08 PM
> > To: freebsd-net at freebsd.org
> > Subject: packet generator
> >
> > Does anybody have a free, in-kernel tool to generate packets quicky
> > and send them out a particular etherent interface on FreeBSD?
> > Something similar to pktgen on linux?
> >
> > I'm trying to excersize just the send-side of programmable firmware
> > based NIC. The recieve side of the NIC firmware is not yet written,
> > but I want to get started tuning and shaking the bugs out of the send
> > side while the firmware author does the recieve path. The packets
> > just get dropped on the floor by the NIC, so its a good way to test
> > the interface..
> >
>
> ng_source was a netgraph module we wrote and contributed.
> It can transmit ~800Kpps on a PCI-X system. The code is in
> src/sys/netgraph/ng_source.c.
> I drive it with a tcl library that can create arbitrary
> packets with an object-oriented model, let me know if you'd
> like to try that.
That would be wonderful.. I think I also need a clue ;)
Right now, what I've done is this:
ifconfig mx0 inet 192.168.1.7 up
kldload ng_ether
kldload ng_source
ngctl mkpeer mx0: source orphans output
# use a captured icmp frame as transmit data
cat ~/icmp.raw | nghook mx0:orphans input
ngctl msg mx0:orphans start 1600
This all works fine, and netstat tells me my driver sent the 1600
frames. ngctl msg mx0:orphans getstats shows me the elapsted time,
etc.
However, I can't seem to do it twice in a row. Eg, a second
ngctl msg mx0:orphans start 1600
does not result in any frames being sent. I've also tried this on an
em interface, so I don't think its anything about my driver. I've
tried clrdata and re-doing the nghook input, and it does not seem to
help. The only way I've found to re-test is to reboot the machine..
What am I doing wrong? (this is RELENG_5 from ~1 week ago).
Thanks,
Drew
More information about the freebsd-net
mailing list