From ebd64739ac6e6743aeca993eaafeed82f06a0e08 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 10 Oct 2016 17:05:55 +0200 Subject: network: add new "tunnel_type" option This one can be either "tun" or "tap" and will lead to the creation of a tunnel interface. --- sbin/init.d/network | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sbin/init.d/network b/sbin/init.d/network index 90ab30d..26c4e8e 100755 --- a/sbin/init.d/network +++ b/sbin/init.d/network @@ -51,6 +51,7 @@ option bonding option_bonding option slave multiple_option option bridge multiple_option option bridge_stp boolean_option 0 +option tunnel_type standard_option option sysctl multiple_option option sysset multiple_option option modprobe multiple_option @@ -382,6 +383,13 @@ function do_start { done arg=0 + # create tun/tap + if [ -n "$opt_tunnel_type" ] ; then + if ! ip tuntap add dev $instname mode $opt_tunnel_type; then + echo " ==> create $instname : failed. Trying anyway." + fi + fi + # configure the bridge if [ ${#opt_bridge[*]} -gt 0 ]; then brctl addbr $instname @@ -754,6 +762,13 @@ function do_stop { brctl delbr $instname fi + # delete tun/tap + if [ -n "$opt_tunnel_type" ] ; then + if ! ip tuntap del dev $instname mode $opt_tunnel_type; then + echo " ==> delete $instname : failed. Trying anyway." + fi + fi + arg=${#opt_modprobe[*]} while [ $arg -gt 0 ]; do arg=$[$arg-1] -- 1.7.12.1