diff --git a/src/etc/inc/plugins.inc.d/openvpn/ovpn-linkup b/src/etc/inc/plugins.inc.d/openvpn/ovpn-linkup index 456aa62c9..95f2765bc 100755 --- a/src/etc/inc/plugins.inc.d/openvpn/ovpn-linkup +++ b/src/etc/inc/plugins.inc.d/openvpn/ovpn-linkup @@ -5,7 +5,10 @@ if [ -n "${route_vpn_gateway}" ]; then elif [ -n "${ifconfig_remote}" ]; then /bin/echo ${ifconfig_remote} > /tmp/${1}_router elif [ -n "${ifconfig_local}" ]; then - /usr/local/bin/python3 -c "import netaddr; import sys; print(netaddr.IPNetwork('%s/%s'%(sys.argv[1], sys.argv[2]))[1])" ${ifconfig_local} ${ifconfig_netmask} > /tmp/${1}_router + # 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 elif [ "${dev_type}" = "tun" -a -n "${5}" ]; then /bin/echo ${5} > /tmp/${1}_router fi diff --git a/src/etc/inc/plugins.inc.d/openvpn/tunnel_endpoint.php b/src/etc/inc/plugins.inc.d/openvpn/tunnel_endpoint.php new file mode 100755 index 000000000..1982b1fb9 --- /dev/null +++ b/src/etc/inc/plugins.inc.d/openvpn/tunnel_endpoint.php @@ -0,0 +1,37 @@ +#!/usr/local/bin/php +