[3/3] gre: Introduce 'nohostroute' option

Submitted by Adrian Schmutzler on June 16, 2019, 11:39 a.m.

Details

Message ID 20190616113925.3434-3-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler June 16, 2019, 11:39 a.m.
It is not always necessary to add a host route for the gre peer address.

This introduces a new config option 'nohostroute' (similar to the
option introduced for wireguard in d8e2e19) to allow to disable
the creation of those routes explicitely.

This is a backport from OpenWrt master.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 .../0202-gre-introduce-nohostroute-option.patch    | 77 ++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch

Patch hide | download patch | download mbox

diff --git a/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch b/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
new file mode 100644
index 00000000..9cb8e147
--- /dev/null
+++ b/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
@@ -0,0 +1,77 @@ 
+From: Fabian Bläse <fabian@blaese.de>
+Date: Wed, 29 May 2019 21:08:01 +0200
+Subject: gre: introduce 'nohostroute' option
+
+It is not always necessary to add a host route for the gre peer address.
+
+This introduces a new config option 'nohostroute' (similar to the
+option introduced for wireguard in d8e2e19) to allow to disable
+the creation of those routes explicitely.
+
+Signed-off-by: Fabian Bläse <fabian@blaese.de>
+Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
+Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> [backport]
+
+diff --git a/package/network/config/gre/files/gre.sh b/package/network/config/gre/files/gre.sh
+index ca11e87cfd..b6131d0555 100755
+--- a/package/network/config/gre/files/gre.sh
++++ b/package/network/config/gre/files/gre.sh
+@@ -57,7 +57,7 @@ gre_setup() {
+ 	local remoteip
+ 
+ 	local ipaddr peeraddr
+-	json_get_vars df ipaddr peeraddr tunlink
++	json_get_vars df ipaddr peeraddr tunlink nohostroute
+ 
+ 	[ -z "$peeraddr" ] && {
+ 		proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
+@@ -77,7 +77,9 @@ gre_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"
+@@ -134,7 +136,7 @@ grev6_setup() {
+ 	local remoteip6
+ 
+ 	local ip6addr peer6addr weakif
+-	json_get_vars ip6addr peer6addr tunlink weakif encaplimit
++	json_get_vars ip6addr peer6addr tunlink weakif encaplimit nohostroute
+ 
+ 	[ -z "$peer6addr" ] && {
+ 		proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
+@@ -154,7 +156,9 @@ grev6_setup() {
+ 		break
+ 	done
+ 
+-	( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
++	if [ "${nohostroute}" != "1" ]; then
++		( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
++	fi
+ 
+ 	[ -z "$ip6addr" ] && {
+ 		local wanif="$tunlink"
+@@ -263,6 +267,7 @@ proto_gre_init_config() {
+ 	proto_config_add_string "ipaddr"
+ 	proto_config_add_string "peeraddr"
+ 	proto_config_add_boolean "df"
++	proto_config_add_boolean "nohostroute"
+ }
+ 
+ proto_gretap_init_config() {
+@@ -276,6 +281,7 @@ proto_grev6_init_config() {
+ 	proto_config_add_string "peer6addr"
+ 	proto_config_add_string "weakif"
+ 	proto_config_add_string "encaplimit"
++	proto_config_add_boolean "nohostroute"
+ }
+ 
+ proto_grev6tap_init_config() {
+-- 
+2.11.0
+

Comments

Fabian Blaese June 16, 2019, 8:45 p.m.
Ich habe jetzt nicht geprüft, ob mit dem Patch alles in Ordnung ist. Aber wir brauchen das später für Gre, daher:

Acked-by: Fabian Bläse <fabian@blaese.de>

On 16.06.19 13:39, Adrian Schmutzler wrote:
> It is not always necessary to add a host route for the gre peer address.
> 
> This introduces a new config option 'nohostroute' (similar to the
> option introduced for wireguard in d8e2e19) to allow to disable
> the creation of those routes explicitely.
> 
> This is a backport from OpenWrt master.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  .../0202-gre-introduce-nohostroute-option.patch    | 77 ++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
>  create mode 100644 build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
> 
> diff --git a/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch b/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
> new file mode 100644
> index 00000000..9cb8e147
> --- /dev/null
> +++ b/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
> @@ -0,0 +1,77 @@
> +From: Fabian Bläse <fabian@blaese.de>
> +Date: Wed, 29 May 2019 21:08:01 +0200
> +Subject: gre: introduce 'nohostroute' option
> +
> +It is not always necessary to add a host route for the gre peer address.
> +
> +This introduces a new config option 'nohostroute' (similar to the
> +option introduced for wireguard in d8e2e19) to allow to disable
> +the creation of those routes explicitely.
> +
> +Signed-off-by: Fabian Bläse <fabian@blaese.de>
> +Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
> +Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> [backport]
> +
> +diff --git a/package/network/config/gre/files/gre.sh b/package/network/config/gre/files/gre.sh
> +index ca11e87cfd..b6131d0555 100755
> +--- a/package/network/config/gre/files/gre.sh
> ++++ b/package/network/config/gre/files/gre.sh
> +@@ -57,7 +57,7 @@ gre_setup() {
> + 	local remoteip
> + 
> + 	local ipaddr peeraddr
> +-	json_get_vars df ipaddr peeraddr tunlink
> ++	json_get_vars df ipaddr peeraddr tunlink nohostroute
> + 
> + 	[ -z "$peeraddr" ] && {
> + 		proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
> +@@ -77,7 +77,9 @@ gre_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"
> +@@ -134,7 +136,7 @@ grev6_setup() {
> + 	local remoteip6
> + 
> + 	local ip6addr peer6addr weakif
> +-	json_get_vars ip6addr peer6addr tunlink weakif encaplimit
> ++	json_get_vars ip6addr peer6addr tunlink weakif encaplimit nohostroute
> + 
> + 	[ -z "$peer6addr" ] && {
> + 		proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
> +@@ -154,7 +156,9 @@ grev6_setup() {
> + 		break
> + 	done
> + 
> +-	( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
> ++	if [ "${nohostroute}" != "1" ]; then
> ++		( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
> ++	fi
> + 
> + 	[ -z "$ip6addr" ] && {
> + 		local wanif="$tunlink"
> +@@ -263,6 +267,7 @@ proto_gre_init_config() {
> + 	proto_config_add_string "ipaddr"
> + 	proto_config_add_string "peeraddr"
> + 	proto_config_add_boolean "df"
> ++	proto_config_add_boolean "nohostroute"
> + }
> + 
> + proto_gretap_init_config() {
> +@@ -276,6 +281,7 @@ proto_grev6_init_config() {
> + 	proto_config_add_string "peer6addr"
> + 	proto_config_add_string "weakif"
> + 	proto_config_add_string "encaplimit"
> ++	proto_config_add_boolean "nohostroute"
> + }
> + 
> + proto_grev6tap_init_config() {
> +-- 
> +2.11.0
> +
>
Fabian Blaese June 27, 2019, 6:14 p.m.
Passt.

Reviewed-by: Fabian Bläse <fabian@blaese.de>
Adrian Schmutzler July 2, 2019, 11:13 a.m.
Applied.

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf Of
> Adrian Schmutzler
> Sent: Sonntag, 16. Juni 2019 13:39
> To: franken-dev@freifunk.net
> Subject: [PATCH 3/3] gre: Introduce 'nohostroute' option
> 
> It is not always necessary to add a host route for the gre peer address.
> 
> This introduces a new config option 'nohostroute' (similar to the
> option introduced for wireguard in d8e2e19) to allow to disable
> the creation of those routes explicitely.
> 
> This is a backport from OpenWrt master.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  .../0202-gre-introduce-nohostroute-option.patch    | 77
> ++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
>  create mode 100644
> build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
> 
> diff --git
> a/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
> b/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
> new file mode 100644
> index 00000000..9cb8e147
> --- /dev/null
> +++ b/build_patches/openwrt/0202-gre-introduce-nohostroute-option.patch
> @@ -0,0 +1,77 @@
> +From: Fabian Bläse <fabian@blaese.de>
> +Date: Wed, 29 May 2019 21:08:01 +0200
> +Subject: gre: introduce 'nohostroute' option
> +
> +It is not always necessary to add a host route for the gre peer address.
> +
> +This introduces a new config option 'nohostroute' (similar to the
> +option introduced for wireguard in d8e2e19) to allow to disable
> +the creation of those routes explicitely.
> +
> +Signed-off-by: Fabian Bläse <fabian@blaese.de>
> +Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE
> increase]
> +Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> [backport]
> +
> +diff --git a/package/network/config/gre/files/gre.sh
> b/package/network/config/gre/files/gre.sh
> +index ca11e87cfd..b6131d0555 100755
> +--- a/package/network/config/gre/files/gre.sh
> ++++ b/package/network/config/gre/files/gre.sh
> +@@ -57,7 +57,7 @@ gre_setup() {
> + 	local remoteip
> +
> + 	local ipaddr peeraddr
> +-	json_get_vars df ipaddr peeraddr tunlink
> ++	json_get_vars df ipaddr peeraddr tunlink nohostroute
> +
> + 	[ -z "$peeraddr" ] && {
> + 		proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
> +@@ -77,7 +77,9 @@ gre_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"
> +@@ -134,7 +136,7 @@ grev6_setup() {
> + 	local remoteip6
> +
> + 	local ip6addr peer6addr weakif
> +-	json_get_vars ip6addr peer6addr tunlink weakif encaplimit
> ++	json_get_vars ip6addr peer6addr tunlink weakif encaplimit nohostroute
> +
> + 	[ -z "$peer6addr" ] && {
> + 		proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
> +@@ -154,7 +156,9 @@ grev6_setup() {
> + 		break
> + 	done
> +
> +-	( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
> ++	if [ "${nohostroute}" != "1" ]; then
> ++		( proto_add_host_dependency "$cfg" "$peer6addr" "$tunlink" )
> ++	fi
> +
> + 	[ -z "$ip6addr" ] && {
> + 		local wanif="$tunlink"
> +@@ -263,6 +267,7 @@ proto_gre_init_config() {
> + 	proto_config_add_string "ipaddr"
> + 	proto_config_add_string "peeraddr"
> + 	proto_config_add_boolean "df"
> ++	proto_config_add_boolean "nohostroute"
> + }
> +
> + proto_gretap_init_config() {
> +@@ -276,6 +281,7 @@ proto_grev6_init_config() {
> + 	proto_config_add_string "peer6addr"
> + 	proto_config_add_string "weakif"
> + 	proto_config_add_string "encaplimit"
> ++	proto_config_add_boolean "nohostroute"
> + }
> +
> + proto_grev6tap_init_config() {
> +--
> +2.11.0
> +
> --
> 2.11.0