How can I create and use a Tap device
julian at elischer.org
Thu Nov 18 18:49:44 GMT 2004
Robert Watson wrote:
>On Thu, 18 Nov 2004, Elton Machado wrote:
>>I need a virtual ethernet device, can I use tap for that?
>>How can I create it?
>A couple of performance caveats:
>- Every packet delivery requires going to user space, so possibly a
> context switch and certainly a system call.
>- Every packet is copied to user space, and/or from user space, so you get
> a lot of memory copying.
You can also use netgraph's eiface node.
thid delivers teh packet to a netgraph interface which can be then used
for further processing in the kernel..
(e.g. a ksocket node to encapsulate it in UDP).. No extra context
>For prototyping or light-weight stuff, tap is a great tool, but to improve
>performance you want to run network code in the kernel, especially if
>there are other applications running (and/or processing packets), which
>will increase the number of context switches. The cost as it stands isn't
>bad -- I regularly use tap-derived tunnel software for remote network
>access without a hitch. There were recently some posts made with patches
>to optimize the allocation of kernel memory for packets sent using a tap
>device, which are in the mailing list archives (not sure if they were
>Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
>robert at fledge.watson.org Principal Research Scientist, McAfee Research
>freebsd-net at freebsd.org mailing list
>To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
More information about the freebsd-net