ipip: add 'nohostroute' option
authorMatthew Hagan <mnhagan88@gmail.com>
Tue, 18 Jan 2022 12:24:54 +0000 (12:24 +0000)
committerHans Dedecker <dedeckeh@gmail.com>
Wed, 19 Jan 2022 19:57:59 +0000 (20:57 +0100)
Add the nohostroute option as available for gre and wg tunnels to
allow the user to prevent explicit creation of a route to the peer
address.

Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
package/network/config/ipip/Makefile
package/network/config/ipip/files/ipip.sh

index c262182558c62e07e52c7630bf1c08bff414e053..4494e1b81fd2812b2156f23ffc4230ef678178d7 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ipip
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_LICENSE:=GPL-2.0
 
 include $(INCLUDE_DIR)/package.mk
index 15b1c978e31b1809021ce15aef4aa656b23886b7..c433ee0de4d81bf6259f9f6d0990ebcacfcf171c 100755 (executable)
@@ -12,7 +12,7 @@ proto_ipip_setup() {
        local remoteip
 
        local df ipaddr peeraddr tunlink ttl tos zone mtu
-       json_get_vars df ipaddr peeraddr tunlink ttl tos zone mtu
+       json_get_vars df ipaddr peeraddr tunlink ttl tos zone mtu nohostroute
 
        [ -z "$peeraddr" ] && {
                proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
@@ -32,7 +32,9 @@ proto_ipip_setup() {
                break
        done
 
-       ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
+       if [ "${nohostroute}" != "1" ]; then
+               ( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
+       fi
 
        [ -z "$ipaddr" ] && {
                local wanif="$tunlink"
@@ -84,6 +86,7 @@ proto_ipip_init_config() {
        proto_config_add_string "ipaddr"
        proto_config_add_string "peeraddr"
        proto_config_add_boolean "df"
+       proto_config_add_boolean "nohostroute"
 }
 
 [ -n "$INCLUDE_ONLY" ] || {