7 function init_table
() {
8 # Check if table does already exist. If not we add it.
9 if (ip rule |
grep -q "static" >/dev
/null
2>&1); then
13 ip rule add table static
16 function create_all_routes
() {
21 ip route flush table static
>/dev
/null
2>&1
28 # Read all routes from the configuration file and add the enabled ones
30 while IFS
=, read status network gateway remark
; do
31 [ "${status}" = "on" ] ||
continue
33 if [ -z "${network}" -o -z "${gateway}" ]; then
34 # Silently skipping invalid routes.
38 ip route add
${network} via
${gateway} table static proto static
42 CONFIGFILE
="/var/ipfire/main/routing"
46 boot_mesg
"Adding static routes..."
48 # First, initialize the table
52 create_all_routes
${CONFIGFILE}
58 boot_mesg
"Removing static routes..."
59 ip route flush table static
>/dev
/null
2>&1
64 echo "Usage: ${0} {start|stop|reload}"