wireguard: introduce 'nohostroute' option

Instead of creating host-routes depending on fwmark as (accidentally)
pushed by commit
1e8bb50b93 ("wireguard: do not add host-dependencies if fwmark is set")
use a new config option 'nohostroute' to explicitely prevent creation
of the route to the endpoint.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
openwrt-19.07
Daniel Golle 2019-03-27 22:59:03 +01:00
parent 7204736076
commit 28920330f8
1 changed files with 2 additions and 1 deletions

View File

@ -114,6 +114,7 @@ proto_wireguard_setup() {
config_get mtu "${config}" "mtu"
config_get fwmark "${config}" "fwmark"
config_get ip6prefix "${config}" "ip6prefix"
config_get nohostroute "${config}" "nohostroute"
# create interface
ip link del dev "${config}" 2>/dev/null
@ -176,7 +177,7 @@ proto_wireguard_setup() {
done
# endpoint dependency
if [ ! "${fwmark}" ]; then
if [ "${nohostroute}" != "1" ]; then
wg show "${config}" endpoints | \
sed -E 's/\[?([0-9.:a-f]+)\]?:([0-9]+)/\1 \2/' | \
while IFS=$'\t ' read -r key address port; do