wireguard: introduce 'nohostroute' option
[openwrt/staging/rmilecki.git] / package / network / services / wireguard / files / wireguard.sh
index 58e47f9450c4dcc86f1fc19a84bcc48d53134bc8..fb781070d6c566c4367a59ff573b7a1aed52e71f 100644 (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