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

_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to