More results.

This commit is contained in:
Adam Ierymenko 2015-11-10 15:47:18 -08:00
parent 0cf4ddda4a
commit 141e2db38c
3 changed files with 0 additions and 108 deletions

View File

@ -1,85 +0,0 @@
tun/tap driver for Mac OS X
===========================
This is an experimental IP tunnel/ethertap driver for Mac OS X/Darwin. It
provides /dev/tunX and /dev/tapX devices. The maximum number of devices can be
configured at compile time, it is currently set to 16. That should be enough in
most cases.
The driver ships as two kernel extensions, one for tap and one for tun. They are
located in /Library/Extensions and can also be loaded and unloaded by hand. If
you install the startup item, the system will load them automatically at
startup (tun and tap startup items get installed in /Library/StartupItems).
Operation & Programming notes
=============================
tapX are ethertap devices which provide an interface to the kernel's ethernet
layer. Packets can be read from and written to the /dev/tapX character devices
one at a time (same name as the interface that shows up in ifconfig).
tunX are IP tunnel devices. These can be used to exchange IP packets with the
kernel. You will get single packets for each read() and should write() packets
one at a time to /dev/tunX.
There are some special ioctls with the tun devices that allow you to have them
prepend the address family of the packet when reading it from /dev/tunX. Using
this mode the driver also expects you put this 4-byte address family field
(network byte order) in front of the packets you write to /dev/tunX.
Here are the ioctls to setup up address prepending mode (for convenience there
also is a header called tun_ioctls.h in the source package that you can use)
Set the int argument to one if you want to have AF prepending, use 0 if you want
to switch it off.
#define TUNSIFHEAD _IOW('t', 96, int)
#define TUNGIFHEAD _IOR('t', 97, int)
Prepending mode is off by default. Currently it is not recommended to switch the
mode while packets are in flight on the device.
The character devices are always visible in the filesystem as /dev/tunX and
/dev/tapX. The number of available character devices is a compile time constant
and is currently fixed to 16. Each character devices is associated with a
network interface of the same name. The network interfaces are only created when
the corresponding character device is opened by a program and will be removed
when the character device is closed.
The character devices currently provide a pretty minimal interface. Whole
packets are read and written using a singe read/write call. File descriptors
opened on the devices can also be select()ed and support O_NONBLOCK.
Asynchronous i/o and some ioctls are currently unimplemented, but implementing
them shouldn't be very hard. Do it yourself or contact me if you can't live
without.
There is another limitation imposed by the Darwin 8 kernel. It concerns the
poll() system call; Darwin currently does *not* support that for (character)
devices. Use select() instead.
The interfaces can be configured using ifconfig, the tap devices also support
setting the MAC address to be used. Both tun and tap should be ready for IPv6.
Just setup addresses and routing as you would do with other interfaces.
Please contact me if you find any bugs or have suggestions.
Enjoy!
Mattias
<mattias.nissler@gmx.de>
Uninstalling
============
The installer packages for OS X currently don't have support for uninstall as
the installer doesn't provide it. Remove the following directories if you want
to completely remove the files installed:
/Library/Extensions/tap.kext
/Library/Extensions/tun.kext
/Library/StartupItems/tap
/Library/StartupItems/tun
Unload the the kernel extensions or reboot and you're done.

View File

@ -1,23 +0,0 @@
Building the tap for both x86_64 and i386 requires an older version of the
Xcode tools than what now ships for Mavericks (10.9). The newer version
does not support creating i386 kernel images.
At the moment this is done on an OSX 10.6 virtual image that is used for
building. (It doesn't have to be done often.) Then the kext is signed on
the regular build system. That's because images built on newer OSX don't
seem to load on 10.6 but 10.6 built kexts seem fine on 10.9. Go figure.
Older Xcode can also be found at:
https://developer.apple.com/downloads
It requires a bit of a dance to unpack the package and obtain an unpacked
tree, but once it's there you can change the line in tap/Makefile and
build for both architectures.
This will go on until i386 is thoroughly legacy, at which point we'll
probably start just supporting x86_64. But that might be a while. We want
to support old Macs through their entire useful life.
Since this build is irritating, a pre-built copy is packaged in ext/ and
is installed by 'make install'. So users shouldn't have to build this.

Binary file not shown.