# #
###############################################################################
+PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin
+
LIBDIR=/usr/lib/firewall
function include() {
reload)
;;
restart)
+ # XXX Do restart function here
+ _stop
+ _start
+ _exit $@
;;
start)
_start
_exit $@
;;
stop)
+ _stop
+ _exit $@
;;
*)
usage
# Need to get all zones here
iptables_commit
+ touch /var/lock/subsys/firewall
+}
+
+function _stop() {
+ rm -f /var/lock/subsys/firewall
}
# #
###############################################################################
-. /etc/sysconfig/network
+[ -f "/etc/sysconfig/network" ] && . /etc/sysconfig/network
+
+function is_mac() {
+ egrep "^[0-9a-f][0-9a-f]\:[0-9a-f][0-9a-f]\:[0-9a-f][0-9a-f]\:[0-9a-f][0-9a-f]\:[0-9a-f][0-9a-f]\:[0-9a-f][0-9a-f]$" <<<$1
+}
function get_device_by_mac() {
local mac=$1
fi
return 1
}
+
+function device_exists() {
+ ip link show ${1} &>/dev/null
+}
+
+function zone_exists() {
+ [ -e "$CONFIG_ZONES/$1" ] #|| device_exists $@
+}
+
+function bridge_devices() {
+ : #TODO
+}
MAC=$(get_mac_by_device ${INTERFACE})
+logger -t net "Received uevent for $INTERFACE ($ACTION)."
+
case $ACTION in
add|register)
# Don't do anything if the network is stopped
interface=${IFCONFIG##*/}
+. /etc/init.d/networking/functions
+
case "${2}" in
up)
+ if ! device_exists ${BRIDGE}; then
+ MESSAGE="Bringing up bridge ${BRIDGE}..."
+ brctl addbr ${BRIDGE} || failed=1
+ ip link set ${BRIDGE} up || failed=1
+ (exit ${failed})
+ evaluate_retval
+ fi
+
MESSAGE="Adding slave interface ${interface} to the ${1} interface..."
- ip link set ${interface} up || failed=1
- brctl addif ${1} ${interface} || failed=1
- (exit ${failed})
+ brctl addif ${1} ${interface}
evaluate_retval
;;
down)
MESSAGE="Removing slave interface ${interface} from the ${1} interface..."
- brctl delif ${1} ${interface} || failed=1
- ip link set ${interface} down || failed=1
- (exit ${failed})
+ brctl delif ${1} ${interface}
evaluate_retval
;;