Debugging a netgraph node

Julian Elischer julian at elischer.org
Wed Jun 17 06:24:21 UTC 2009


Bob Van Zant wrote:
> I'm experimenting with netgraph to try to implement an IPv6 -> IPv4 gateway,
> as specified here:
> 
> http://tools.ietf.org/html/draft-xli-behave-ivi-02

hi bob,
  I can give you a hand if you want..
I'm busy tomorrow Morning but I can give you a call tomorrow afternoon 
if you like..

also, Joe in India has been using netgraph..

> 
> This is my first time ever working with netgraph and I admit to being a bit
> lost. I have a netgraph node that gets wired up with an ng_ether node. My
> lower hook gets wired to the ng_ether lower hook and my upper to his upper.
> It's receiving IPv6 + UDP packets, creating IPv4 + UDP packets and then
> writing the new packets out with NG_FWD_NEW_DATA.
> 
> I'm perfectly willing to waste time making stupid mistakes on this project,
> however, right now I'm stuck. I can't "find" the translated packets I'm
> writing anywhere to see what, if anything, is wrong with them. They don't
> show up in tcpdump on the local machine (I've tried writing to both the
> upper and lower hook). They don't show up in tcpdump on other machines on
> the network.
> 
> I tried attaching nghook to the "orphans" hook of the ng_ether node but it
> doesn't appear to be seeing any data.

add a tee node between your node and the ether hook to see what you 
are sending.

> 
> netstat -s -p udp doesn't show any packets when my node is enabled (I think
> this means my node is effectively swallowing them).

probably

> 
> I've tried to figure out how to wire in an ng_tee node but I'm a little lost
> as to how to do this (I still haven't figured out the ngctl syntax).

ahh
#add a tee to the ethernet lower hook
ngctl mkpeer em3: tee lower left
ngctl name em3:lower lowertee



#then add your node to the right hook of the tee.
ngctl mkpeer lowertee: mytype right lower
ngctl name lowertee:right mynode

#similar for the upper hook except that you use connect instead of 
#mkpeer for the last step as your node already exists.

ngctl mkpeer em3: tee upper left
mgctl name em3:upper uppertee
ngctl connect uppertee: mynode: upper upper

-------
now you can examine traffic on the two tee nodes let2right hook and 
rigt2left hook


> 
> Any tips for figuring out what I'm doing wrong? Debug options to enable that
> will show me more information about what's happening after I call
> NG_FWD_NEW_DATA? If I got ng_tee wired in would it's tap hooks show me what
> I want? A better way to try to tee the data?
> 
> Thanks,
> 
> Bob
> 
> 
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"



More information about the freebsd-net mailing list