summaryrefslogtreecommitdiffstats
path: root/init.d/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'init.d/bridge')
-rwxr-xr-xinit.d/bridge38
1 files changed, 38 insertions, 0 deletions
diff --git a/init.d/bridge b/init.d/bridge
new file mode 100755
index 0000000..bfbf057
--- /dev/null
+++ b/init.d/bridge
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+
+BRCTL=`which brctl 2>/dev/null`
+
+start() {
+ # abort if brctl does not exist
+ for brspec in $BRIDGES; do
+ retcode=0
+ br=`echo $brspec | cut -d= -f1`
+ ebegin "Setting up bridge $br"
+ if [ -z "$BRCTL" ] ; then
+ eerror "Need bridge-utils to be able to set up $br"
+ retcode=1
+ else
+ brctl addbr $br || retcode=1
+ bridge_ifs=`echo "$BRIDGES" | sed 's/.*=//; s/\+/ /g'`
+ for iface in $bridge_ifs ; do
+ # set if in promisc mode
+ ifconfig $iface 0.0.0.0 promisc up || retcode=1
+ brctl addif $br $iface || retcode=1
+ done
+ fi
+ eend $retcode
+ done
+
+}
+
+stop() {
+ which brctl > /dev/null 2>&1 || return 1
+ for brspec in $BRIDGES; do
+ br=`echo $brspec | cut -d= -f1`
+ ebegin "Shutting down bridge $br"
+ brctl delbr $br
+ eend $?
+ done
+
+
+}