]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
Several networking stuff.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 21 Feb 2009 22:19:22 +0000 (23:19 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 21 Feb 2009 22:19:22 +0000 (23:19 +0100)
src/firewall/firewall
src/firewall/functions
src/initscripts/networking/functions
src/initscripts/networking/net-hotplug
src/initscripts/networking/services/bridge-slave

index d5197bbae14cf35d414626022104a1bb1453a205..8d6c905efff3bbdfaf2c0b16d91aa1d3ed081f86 100644 (file)
@@ -33,6 +33,8 @@
 #                                                                             #
 ###############################################################################
 
+PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin
+
 LIBDIR=/usr/lib/firewall
 
 function include() {
@@ -92,12 +94,18 @@ while [ "$#" -gt 0 ]; do
                reload)
                        ;;
                restart)
+                       # XXX Do restart function here
+                       _stop
+                       _start
+                       _exit $@
                        ;;
                start)
                        _start
                        _exit $@
                        ;;
                stop)
+                       _stop
+                       _exit $@
                        ;;
                *)
                        usage
index 91fd21cb7e0219c9cf0cde6c4e1754e08d2264d8..567973dc25a76914ce8793cc9544a9910516154b 100644 (file)
@@ -96,4 +96,9 @@ function _start() {
        # Need to get all zones here
 
        iptables_commit
+       touch /var/lock/subsys/firewall
+}
+
+function _stop() {
+       rm -f /var/lock/subsys/firewall
 }
index 98ecb1c88aefaa8e1a6bdbb55ffa92d07e5e5e22..ee65e3c63539dadfab200617792286ee4c5442f4 100644 (file)
 #                                                                             #
 ###############################################################################
 
-. /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
@@ -38,3 +42,15 @@ function get_mac_by_device() {
        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
+}
index a2d4cd3a41209d7cf60bb7a470c705ddef814c20..fd79681e5e59e1b9f69016484ea1f168080b7cc6 100644 (file)
@@ -27,6 +27,8 @@ fi
 
 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
index 3780ba99837b693227275c08c7e24e69ad08bf8a..16b9eb7e28bc92128805fe065eba979f33b81e38 100644 (file)
 
 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
        ;;