]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Initial commit for static routing.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 1 Jul 2011 18:17:26 +0000 (20:17 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 1 Jul 2011 18:17:26 +0000 (20:17 +0200)
Add script that initializes the routing table and is supposed to
set the routes.

lfs/iproute2
src/initscripts/init.d/static-routes [new file with mode: 0644]

index 3cc684483b711da7df627a2e4c4e90171e81cb56..50ccf40df3014209153c13f5460aaca6770595b6 100644 (file)
@@ -76,5 +76,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        cd $(DIR_APP) && make $(MAKETUNING) SBINDIR=/sbin
        cd $(DIR_APP) && make SBINDIR=/sbin install
        cd $(DIR_APP) && mv -v /sbin/arpd /usr/sbin
+
+       # Add table for static routing
+       echo "200       static" >> /etc/iproute2/rt_tables
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
diff --git a/src/initscripts/init.d/static-routes b/src/initscripts/init.d/static-routes
new file mode 100644 (file)
index 0000000..184f97d
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+
+function init_table() {
+       # Check if table does already exist. If not we add it.
+       if (ip rule | grep -qeE static >/dev/null 2>&1); then
+               return
+       fi
+
+       ip rule add table static
+}
+
+
+case "${1}" in
+       start)
+               boot_mesg "Adding static routes..."
+
+               # First, initialize the table
+                init_table
+
+               ### ADD ALL ROUTES
+
+               evaluate_retval
+                ;;
+
+        stop)
+               boot_mesg "Removing static routes..."
+                ip route flush table static >/dev/null 2>&1
+               evaluate_retval
+                ;;
+
+        *)
+               echo "Usage: ${0} {start|stop}"
+                       exit 1
+                ;;
+esac