I dunno what state this is in, but I might want to keep it.

This commit is contained in:
2026-09-02 05:55:59 -04:00
parent 6b02d9d58e
commit 0e27fd9cd5
10 changed files with 1137 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
_genfile="${route_policy_file}"
if [ -z "${_genfile}" ]
then
_genfile="/dev/fd/1"
fi
__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 $* ${_genfile}
}
install_route_policy_v4()
{
_install_route_policy_v4 internal $* ${_genfile}
}
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 > $_genfile
}
# vim: ft=sh