38 lines
1.1 KiB
Plaintext
38 lines
1.1 KiB
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
if [ ${MODE} == "start" ]
|
||
|
then
|
||
|
set -ue
|
||
|
elif [ ${MODE} == "stop" ]
|
||
|
then
|
||
|
set -u
|
||
|
else
|
||
|
echo "$(basename ${0}): mode must be one of either 'start' or 'stop'" 1>&2
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
case ${PHASE} in
|
||
|
"pre-up")
|
||
|
{% if vpn_bridge_routing_table is defined %}
|
||
|
/usr/sbin/ip -4 rule add dev $IFACE table {{ vpn_bridge_routing_table }}
|
||
|
/usr/sbin/ip -6 rule add dev $IFACE table {{ vpn_bridge_routing_table }}
|
||
|
|
||
|
/usr/sbin/ip -4 rule add dev $IFACE to {{ local_inet_network }} table main priority 1
|
||
|
/usr/sbin/ip -6 rule add dev $IFACE to {{ local_inet6_network }} table main priority 1
|
||
|
{% endif %}
|
||
|
;;
|
||
|
"post-up")
|
||
|
;;
|
||
|
"pre-down")
|
||
|
;;
|
||
|
"post-down")
|
||
|
{% if vpn_bridge_routing_table is defined %}
|
||
|
/usr/sbin/ip -6 rule del dev $IFACE to {{ local_inet6_network }} table main priority 1
|
||
|
/usr/sbin/ip -4 rule del dev $IFACE to {{ local_inet_network }} table main priority 1
|
||
|
|
||
|
/usr/sbin/ip -6 rule del dev $IFACE table {{ vpn_bridge_routing_table }}
|
||
|
/usr/sbin/ip -4 rule del dev $IFACE table {{ vpn_bridge_routing_table }}
|
||
|
{% endif %}
|
||
|
;;
|
||
|
esac
|