From patchwork Sun May 26 10:19:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Richard via openwrt-devel X-Patchwork-Id: 1105538 X-Patchwork-Delegate: dedeckeh@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lists.openwrt.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mV2RYruB"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45BbhT6d1tz9s9N for ; Sun, 26 May 2019 20:20:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Date:Sender:Content-Type: Subject:List-Help:Reply-To:List-Archive:List-Unsubscribe:List-Subscribe:Cc: From:List-Post:List-Id:Message-ID:MIME-Version:To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Ac7QZeB5G+RX0uXg+h5A68wi2I9opF8jO8BHTmM38Mo=; b=mV2RYruBxuRwKoOiLFcIOmfJaY pXKryLZCXbDvzwT6s23/3QeGLx62Kw+vOiNjkjpMwZqesNWPcshDirWuSYFuKusLyL9RL2mn1JwdJ xURKTu+wGS+QSUzDe5ugAoJ9qgqvkutUR5wwjjHl+/QjICYL7hFPHp4pzH4NgR714b+fyQaw0ZDV9 Sr/YrMKb+Z4Crk1GA2Y3fh8NNHFpePgvjNumaNcR8tXHjkLjTGE/j3Do1hs+sYK4ECfFGbM84qhz8 HaUlA4Az3NAdncm/RFqI932vlmt1MHcGM+3CC1nHIz3gMdGr21t27MBwLdSo6fmUczyy/9uDeA8wF U2Mde4MQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hUqFq-0002UD-2J; Sun, 26 May 2019 10:19:50 +0000 To: openwrt-devel@lists.openwrt.org MIME-Version: 1.0 Message-ID: List-Id: List-Post: X-Patchwork-Original-From: =?utf-8?q?Fabian_Bl=C3=A4se?= via openwrt-devel From: Thomas Richard via openwrt-devel Precedence: list Cc: =?utf-8?q?Fabian_Bl=C3=A4se?= X-Mailman-Version: 2.1.21 X-BeenThere: openwrt-devel@lists.openwrt.org List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: =?utf-8?q?Fabian_Bl=C3=A4se?= List-Help: Subject: [OpenWrt-Devel] [PATCH] gre: introduce 'nohostroute' option Sender: "openwrt-devel" Date: Sun, 26 May 2019 10:19:50 +0000 Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. 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 --- package/network/config/gre/files/gre.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/package/network/config/gre/files/gre.sh b/package/network/config/gre/files/gre.sh index 2bb1010b76..3414ed3047 100755 --- a/package/network/config/gre/files/gre.sh +++ b/package/network/config/gre/files/gre.sh @@ -56,7 +56,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" @@ -76,7 +76,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" @@ -133,7 +135,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" @@ -153,7 +155,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" @@ -262,6 +266,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() { @@ -275,6 +280,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() {