mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
openvpn: switch to ifctl use for #5862
This commit is contained in:
parent
2e2e59c1d8
commit
386b4679b4
@ -2,5 +2,5 @@
|
||||
|
||||
/sbin/pfctl -i ${1} -Fs
|
||||
|
||||
/bin/rm -f /tmp/${1}_router
|
||||
/bin/rm -f /tmp/${1}_routerv6
|
||||
/usr/local/sbin/ifctl -4ci ${1}
|
||||
/usr/local/sbin/ifctl -6ci ${1}
|
||||
|
||||
@ -1,26 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
ROUTERV4=
|
||||
ROUTERV6=
|
||||
|
||||
if [ -n "${route_vpn_gateway}" ]; then
|
||||
/bin/echo ${route_vpn_gateway} > /tmp/${1}_router
|
||||
ROUTERV4="-a ${route_vpn_gateway}"
|
||||
elif [ -n "${ifconfig_remote}" ]; then
|
||||
/bin/echo ${ifconfig_remote} > /tmp/${1}_router
|
||||
ROUTERV4="-a ${ifconfig_remote}"
|
||||
elif [ -n "${ifconfig_local}" ]; then
|
||||
# XXX: We can't reliably determine the tunnels endpoint, other than parsing ifconfig.
|
||||
# Use our standard parser to request the tunnels other end. Eventually we could pass this to configd if
|
||||
# needed, but openvpn has elevated rights anyway at the moment.
|
||||
/usr/local/etc/inc/plugins.inc.d/openvpn/tunnel_endpoint.php ${1} > /tmp/${1}_router
|
||||
ROUTERV4="-a $(/usr/local/etc/inc/plugins.inc.d/openvpn/tunnel_endpoint.php ${1})"
|
||||
elif [ "${dev_type}" = "tun" -a -n "${5}" ]; then
|
||||
/bin/echo ${5} > /tmp/${1}_router
|
||||
ROUTERV4="-a ${5}"
|
||||
fi
|
||||
|
||||
if [ -n "${route_ipv6_gateway_1}" ]; then
|
||||
/bin/echo ${route_ipv6_gateway_1} > /tmp/${1}_routerv6
|
||||
ROUTERV6="-a ${route_ipv6_gateway_1}"
|
||||
elif [ -n "${ifconfig_ipv6_remote}" ]; then
|
||||
/bin/echo ${ifconfig_ipv6_remote} > /tmp/${1}_routerv6
|
||||
ROUTERV6="-a ${ifconfig_ipv6_remote}"
|
||||
elif [ -n "${ifconfig_ipv6_local}" ]; then
|
||||
/bin/echo ${ifconfig_ipv6_local} > /tmp/${1}_routerv6
|
||||
ROUTERV6="-a ${ifconfig_ipv6_local}"
|
||||
fi
|
||||
|
||||
/usr/local/sbin/ifctl -4rd ${ROUTERV4}
|
||||
/usr/local/sbin/ifctl -6rd ${ROUTERV6}
|
||||
|
||||
/usr/local/sbin/configctl -d interface newip ${1}
|
||||
|
||||
exit 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user