64 lines
1.2 KiB
Bash
Executable File
64 lines
1.2 KiB
Bash
Executable File
__install_route_policy()
|
|
{
|
|
iface=$1;shift 1
|
|
network=$1;shift 1
|
|
table=$1;shift 1
|
|
|
|
echo "match out on ${iface} from !fd00::/8 to ${network} rtable ${table}" >> $1
|
|
echo "match in on ${iface} from ${network} to !fd00::/8 rtable ${table}" >> $1
|
|
}
|
|
|
|
__install_route_policy_v4()
|
|
{
|
|
iface=$1;shift 1
|
|
network=$1;shift 1
|
|
table=$1;shift 1
|
|
|
|
echo "match out on ${iface} to ${network} rtable ${table}" >> $1
|
|
echo "match in on ${iface} from ${network} rtable ${table}" >> $1
|
|
}
|
|
|
|
_install_route_policy()
|
|
{
|
|
iface=$1;shift 1
|
|
split=`echo $1 | sed -e 's/->/ /g'`;shift 1
|
|
|
|
__install_route_policy $iface ${split} $*
|
|
}
|
|
|
|
_install_route_policy_v4()
|
|
{
|
|
iface=$1;shift 1
|
|
split=`echo $1 | sed -e 's/->/ /g'`;shift 1
|
|
|
|
__install_route_policy_v4 $iface ${split} $*
|
|
}
|
|
|
|
install_route_policy()
|
|
{
|
|
_install_route_policy internal $* ${route_policy_file}
|
|
}
|
|
|
|
install_route_policy_v4()
|
|
{
|
|
_install_route_policy_v4 internal $* ${route_policy_file}
|
|
}
|
|
|
|
|
|
add_route_policy()
|
|
{
|
|
route_policies="${route_policies} $1->$2"
|
|
}
|
|
|
|
add_route_policy_v4()
|
|
{
|
|
route_policies_v4="${route_policies_v4} $1->$2"
|
|
}
|
|
|
|
clear_all_policies()
|
|
{
|
|
echo -n > $route_policy_file
|
|
}
|
|
|
|
# vim: ft=bash
|