#!/bin/sh
. /etc/functions.sh
case "$1" in
  start|restart)
    ifup lan
    ifup wan
    ifup wifi
    wifi up

    if [ "$(nvram get ff_dyngw)" != "0" ]; then
      ip rule add iif lo table dyngw
    fi

    for route in $(nvram get static_route); do {
      eval "set $(echo $route | sed 's/:/ /g')"
      $DEBUG ip route add $1/$(ipcalc -p $1 $2|cut -d'=' -f2) via $3 metric $4 dev $5
    } done
    ;;
esac
