Date: Wed, 14 Feb 2007 08:55:09 +0100 From: Tomas Svensson <tomas@tutus.se> To: Julian Elischer <julian@elischer.org> Cc: freebsd-net@freebsd.org Subject: Re: problem with ng_device as tun replacement Message-ID: <45D2C05D.7000707@tutus.se> In-Reply-To: <45CCDF66.90505@elischer.org> References: <45CC686F.1050409@tutus.se> <45CCDF66.90505@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Julian Elischer wrote: > Tomas Svensson wrote: >> Hi, >> >> I am trying to replace the tun interface using netgraph by linking >> ng_device and ng_iface: >> >> ngctl mkpeer iface dummy inet >> ngctl mkpeer ng0: device inet inet >> >> then I try to use it as a drop-in replacement for tun, but it doesn't >> really work: >> >> 1. If I send an IP packet through /dev/ngd0 (after doing a normal >> open()), the packet doesn't get sent until I write a second packet to >> the device. > > Do you know it the ng-device device is hanging onto it, or the > ng_iface device is getting it but not passing it on? > > If you don't know, you can put a 'tee' node between them > and use nghook(8) to see when the packet is passed between the nodes. > Thanks, I checked with tee and nghook(8) and found the follwing two cases: 1. Packets are arriving from the ng_iface (ng0) via the hook to ng_device (dev/ngd0), but the packets are just queuing up and the descriptor that opened /dev/ngd0 is not marked as readable until there is a number of packets queued. 2. A packet first arrives on /dev/ngd0 and is sent via the hook to ng0. A response packet is later arriving on the interface and is sent back to the device via the hook. Now the packet is stuck. Yet another packet arrives on /dev/ngd0 which makes it let go of the first packet (the first packet is sent out /dev/ngd0 and the new packet is sent via the hook to ng0). I send normal ICMP echo packets and the code works fine with tun(4). -Tomas
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45D2C05D.7000707>