35 lines
889 B
Plaintext
35 lines
889 B
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")
|
||
|
/usr/sbin/ip link add ${IFACE} type bridge
|
||
|
/usr/sbin/ip link set ${IFACE} type bridge forward_delay 0
|
||
|
|
||
|
/usr/sbin/sysctl -q -w net.ipv6.conf.br0.autoconf=0
|
||
|
|
||
|
/usr/sbin/ip -4 address add {{ vpn_bridge_inet_address }}/{{ vpn_bridge_inet_prefixlen }} dev ${IFACE}
|
||
|
/usr/sbin/ip -6 address add {{ vpn_bridge_inet6_address }}/{{ vpn_bridge_inet6_prefixlen }} dev ${IFACE} nodad
|
||
|
;;
|
||
|
"post-up")
|
||
|
;;
|
||
|
"pre-down")
|
||
|
;;
|
||
|
"post-down")
|
||
|
/usr/sbin/ip -6 address flush dev ${IFACE}
|
||
|
/usr/sbin/ip -4 address flush dev ${IFACE}
|
||
|
|
||
|
/usr/sbin/ip link delete ${IFACE}
|
||
|
;;
|
||
|
esac
|