Author: Lisa Denia Date: Thu Jun 11 01:42:09 2009 +0200 network: Add tun/tap support diff --git a/network b/network index 6e68877..eb5fa0f 100755 --- a/network +++ b/network @@ -11,6 +11,8 @@ [ -f /etc/conf.d/bridges ] && . /etc/conf.d/bridges # dhcpcd settings [ -f /etc/conf.d/dhcpcd ] && . /etc/conf.d/dhcpcd +# tun/tap settings +[ -f /etc/conf.d/tuntap ] && . /etc/conf.d/tuntap ifup() { @@ -162,6 +164,22 @@ bridge_down() done } +tap_up() +{ + for tap in ${TAP_INTERFACES[@]}; do + eval tapif="\$tap_${tap}" + tunctl ${tapif} >/dev/null 2>&1 || error=1 + done +} + +tap_down() +{ + for tap in ${TAP_INTERFACES[@]}; do + tapif=$(eval echo \$tap_${tap}) + tunctl ${tapif/-t/-d} >/dev/null 2>&1 || error=1 + done +} + case "$1" in start) @@ -172,6 +190,8 @@ case "$1" in stat_busy "Starting Network" error=0 + # bring up tap interfaces + tap_up # bring up bridge interfaces bridge_up # bring up ethernet interfaces @@ -216,6 +236,8 @@ case "$1" in done # bring down bridge interfaces bridge_down + # bring down tap interfaces + tap_down if [ $error -eq 0 ]; then stat_done else