Much of the core bits are initially ported.

This should be mostly independent of my configs, now.
This commit is contained in:
2026-05-09 03:26:53 -04:00
parent 6b02d9d58e
commit 4d30691ee6
16 changed files with 1278 additions and 2 deletions
+73
View File
@@ -0,0 +1,73 @@
_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
}
#add_route_policy 2602:f6a8:1::/48@9
#add_route_policy 2001:db8:f6a8:1::/64@42
# vim: ft=bash