Re: Simple program use /dev/tap
From: Maksim Yevmenkin (maksim.yevmenkin_at_savvis.net)
Date: 07/29/05
- Previous message: Kris Kennaway: "Re: here we go again with the weird kernel build errors..."
- In reply to: snort Snort: "Re: Simple program use /dev/tap"
- Next in thread: Bsderss: "why tun/tap but instead ordinary ethernet device (eg. fxp)"
- Reply: Bsderss: "why tun/tap but instead ordinary ethernet device (eg. fxp)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Jul 2005 12:55:56 -0700 To: snort Snort <snort_sam@yahoo.com>
Hello,
>>>As I want to learn how to use /dev/tap in freebsd,
>>
>>I m
>>
>>>looking for a simple application that written for
>>>/dev/tap. OpenVPN is a bit too complicated for a
>>>newbie to get start. Can anyone tell me a link or
>>>reference for some of these examples?
>>
>>There are examples that come with the distribution
>>itself:
>>
>>http://vtun.sourceforge.net/tun/tun-1.1.tar.gz
>>
>
> Is this only for tun device?
> How much difference between tun and tap in terms of
> programming when using the device?
>
>
>>(and this question would be better suited for
>>freebsd-questions,
>>if for any FreBSD=specific list at all)
>>
>
> Sorry, I currently don't have access to the
> frebsd.misc newsgroup, so I need to post the question
> here.
this type of question comes up quite often. its really simple: a single
read(2) call on /dev/tapX will return entire ethernet frame (if any)
received by tap interface (minus ethernet crc). a single write(2) call
on /dev/tapX will put entire ethernet frame (w/out ethernet crc) onto
tap interface outgoing queue.
so, the "buf" parameter to the write(2) call on /dev/tapX device should
point to a buffer with *complete* ethernet frame, including ethernet
header and payload. payload could be IP packet, but it does not have to
be. any protocol that uses ethernet as transport can be tunneled with
tap(4) (i.e. ipx).
the above is true for tun(4) with exception that tun(4) operates on IP
packets. so you have to write/read complete IP packets to/from /dev/tun.
thanks,
max
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
- Previous message: Kris Kennaway: "Re: here we go again with the weird kernel build errors..."
- In reply to: snort Snort: "Re: Simple program use /dev/tap"
- Next in thread: Bsderss: "why tun/tap but instead ordinary ethernet device (eg. fxp)"
- Reply: Bsderss: "why tun/tap but instead ordinary ethernet device (eg. fxp)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|