#!/bin/sh

if [ -z "$PPP_IFACE" ]
then
        exit
fi

if [ -n "$PPP_REMOTE" ]
then
        ip route append default nexthop via "$PPP_REMOTE" dev "$PPP_IFACE"
else
        ip route append default nexthop dev "$PPP_IFACE"
fi

if [ -z "$PPP_IPPARAM" ]
then
        exit
fi

ip route flush table "$PPP_IPPARAM"
ip route add default dev "$PPP_IFACE" table "$PPP_IPPARAM"

if [ -z "$PPP_LOCAL" ]
then
        exit
fi

ip rule flush table "$PPP_IPPARAM"
ip rule add from "$PPP_LOCAL" table "$PPP_IPPARAM" priority 1024
ip rule add to "$PPP_LOCAL" table "$PPP_IPPARAM" priority 1024

