Add -tun option for preconfigured interface
PATCH 1/1 Add -tun option for preconfigured interface
I like that the root on the host OS can assign TUN interface to users and that the root configure it. So the user only use the new -tun <devname> option to use the preconfigured TUN interface without the need to execute a trick and unsecure script.
Here is the added desciption:
----------------------------------------------------------------------
-tun devname
Try to use devname while opening a tap/tun host network interface
and use it. If it work, the network init script is not executed for this interface. If it don't work, the interface will use the name assigned by the operating system and the network init script is executed.
This option permit the use of preconfigured interface. For
example, as root you can assign a tun interface to a user and configure it like this:
tunctl -u bob -t tun2
ifconfig tun2 192.168.2.1
Then bob can use this interface with the option "-tun tun2". Note
that option permit the use of a DHCP server on the host to configure the guest interface.
----------------------------------------------------------------------
I have also patched the qemu-doc.html but cvs diff don't work with it.
I have tryed to be compatible with the -tun-fd option, but this is untested. Also the tun_open() function for BSD system will probably not handle this case as expected.
Signature · 1 line
Jean-Christian de Rivaz
Index: qemu-doc.texi
===================================================================
RCS file: /cvsroot/qemu/qemu/qemu-doc.texi,v
retrieving revision 1.55
qemu-doc.texi +16 -0
@@ -212,6 +212,22 @@ aa:bb:cc:dd:ee:ff in hexa). The mac address is incremented for each new network interface. +@item -tun devname +Try to use @var{devname} while opening a tap/tun host network interface and use +it. If it work, the network init script is not executed for this +interface. If it don't work, the interface will use the name assigned +by the operating system and the network init script is executed. + +This option permit the use of preconfigured interface. For example, as +root you can assign a tun interface to a user and configure it like this: +@example +tunctl -u bob -t tun2 +ifconfig tun2 192.168.2.1 +@end example +Then bob can use this interface with the option "-tun tun2". Note that +option permit the use of a DHCP server on the host to configure the +guest interface. + @item -tun-fd fd Assumes @var{fd} talks to a tap/tun host network interface and use it. Read @url{http://bellard.org/qemu/tetrinet.html} to have an
Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.120
vl.c +34 -11
117 lines not on this page · raw message
The arobase caracters in my patch are trashed by the mailing-list process. I don't know how to avoid this.
The first line with the [email protected] must be replaced with a "+ <arobase>item". The second line with a "+ <arobase>exemple" and the last with a "+ <arobase>end example".
Below is just a test to see if ther is some way to work around this.
+ @item # a single arobase.
+ @@item # a double arobase.
+ \@item # backslash and arobase.
Signature · 1 line
Jean-Christian de Rivaz