Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Aug 2005 10:34:21 -0600 (MDT)
From:      "Nathanael M Van Vorst" <vanvorst@ieee.org>
To:        freebsd-net@freebsd.org
Subject:   Netgraph question
Message-ID:  <59841.157.127.124.134.1123691661.squirrel@www.stupendousness.org>

next in thread | raw e-mail | index | archive | help
------=_20050810103421_56376
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

I sent this is Julian a bit ago. I guess he has been too busy to look into
it, so I hope someone else in the community can help! Somehow I lost the
screen shot I refer to in the message below (but its trival to reproduce).

In brief, the code below is supposed to create a KLD/psuedo-device that I
can pass netgraph items to, then later on have a netgraph node get them
back.

Thanks!
--Nate

---------------------------- Original Message ----------------------------
Subject: Re: netgraph question
From:    "Nathanael M Van Vorst" <vanvorst@ieee.org>
Date:    Wed, July 27, 2005 11:55 am
To:      "Julian Elischer" <julian@elischer.org>
--------------------------------------------------------------------------

Sorry my reply has taken so long. I just got back from vacation.

Thank you for taking the time to help!

I am attaching a bit of code I put together. Its attached as a tar
(test.tar).

Please note, this is just a hack I have put together to see if I can get
this concept working before I integrate this into my larger, rather
complicated, project. The tar should extract into a directory named
"test". "test" will have the folling structure:
test
  |-echodev.c
  |-Makefile
  |-wireMe
  |-nateNode
    |-nate.h
    |-nate.c
    |-Makefile
  |-registerNode
    |-reg.c
    |-reg.h
    |-Makfile

The tar consits of three things: 1) <nateNode>a node to receive packets,
print a message to the long then drop the message, 2) <registerNode> a
node that calls system module functions and passes all its items to the
system module, 3) <echodev> a system module or more acturatly a
psuedo-device that takes items from a node and puts them on a queue.

"wireMe" just loads the correctly KLDs for me and wires up a very simple
netgraph graph (which follows). <lnc0> is my ethernet device, <reg> is a
registerNode and <nate> is a nateNode.

<lncO> --> <reg> --> <nate>

When <reg> receives the first message, it calls "setMyHook" with the
destination hook to <nate>. "setMyHook" is in the echoDev and simple
stores the pointer if its current pointer is NULL. After <reg> calls
"setMyHook" is calls "addItem". "addItem" is also in echoDev and simply
places the item at the end of the queue. Also in <reg> I have tried alot
of stuff trying to see what is wrong. All the other crap is just that,
crap.

First, I cat echo dev. Them I cause packets to be sent to <reg> and in
turn handed over to the echoDev. After I see echoDev print the syslog that
it has 5 or more items, I "cat /dev/echo". cat'ing /dev/echo should case
echoDev to call NG_FWD with hook that was passed in and first item that
was passed in. This is where it dies.

Below are the set of commands I type in the 'test' as root
cd test
make clean
make
cd nateNode
make clean
make
cd ../registerNode
make clean
make
cd ..
./wireme
cat /dev/echo
<casue packets to be send to lnc0>
cat /dev/echo
--then the kernel panics. The kernel core is trash so it doesn’t help. I
am attaching a screen shot of the panic.


Thank you for all your efforts (and for netgraph)!


--Nate

---------------------------------------
Nathanael Van Vorst
Home:
   vanvorst@ieee.org
   303-274-6396

“It is intuitively obvious to even the
              most casual of observers!”

------=_20050810103421_56376--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?59841.157.127.124.134.1123691661.squirrel>