From patchwork Tue Nov 24 07:18:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 1405321 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 (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.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=dev.tdt.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=a6fE6Rxl; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CgFld60p3z9sRK for ; Tue, 24 Nov 2020 18:19:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=EMwdw3/RVu7PDMlGM5920ISWhIr/eOmHFSaEKKKeIHk=; b=a6fE6Rxl4MCPKkixSEojSd5jCW T3aK36iw0eFPmYj+bk0n5lUVWCBE8ajG/V4pRoEchhQbnPkHkFXljdcQ+64gjYbTAHXtfmRNrnyR8 G9bKr0wfREz/A/gVLhFp6R9SjkrFEIx4fjTbM3p46w/jyxM797RCY4Us2YRZD1a1vl3fe/EQSBMY4 d4955FFisV6NEgt4N2xC8S2y/4Jy4ZLu7DS0wRtOkGPoMFKKjMNrXuUGmI/DY0oT79SBduPQH+LKY RI/eXuRrs/RJv5I2K5RjRvRYPVHIenx5EVKhGhh0ZSkWnbK+Qu4v9gPdT/nvcJVp4p7O6lNZNwR9V cftYD7Cw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khSah-0003gZ-Hs; Tue, 24 Nov 2020 07:18:19 +0000 Received: from mxout70.expurgate.net ([194.37.255.70]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khSae-0003g7-UR for openwrt-devel@lists.openwrt.org; Tue, 24 Nov 2020 07:18:17 +0000 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.90) (envelope-from ) id 1khSaa-000GmH-4X; Tue, 24 Nov 2020 08:18:12 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90) (envelope-from ) id 1khSaZ-0004DW-Br; Tue, 24 Nov 2020 08:18:11 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id 06241240041; Tue, 24 Nov 2020 08:18:11 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id AA777240040; Tue, 24 Nov 2020 08:18:10 +0100 (CET) Received: from feckert.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 2BFA9204C2; Tue, 24 Nov 2020 08:18:10 +0100 (CET) From: Florian Eckert To: openwrt-devel@lists.openwrt.org Subject: [Patch v2] netifd: add possibility to switch off route config Date: Tue, 24 Nov 2020 08:18:00 +0100 Message-ID: <20201124071800.9080-1-fe@dev.tdt.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de X-purgate-type: clean X-purgate: clean X-purgate-ID: 151534::1606202291-0000CF01-8FAE1DAF/0/0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201124_021817_216637_B572F50C X-CRM114-Status: GOOD ( 13.81 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [194.37.255.70 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dedeckeh@gmail.com, Florian Eckert , nbd@nbd.name Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This change adds the new configuration option `disabled` for the route section, which can be used to temporarily disable the section so that the route is not set. The advantage is that we do not have to delete this route configuration section to achieve this. config route option disabled '1 Signed-off-by: Florian Eckert --- V2: - Fix code style - Create patch from netif repository interface-ip.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface-ip.c b/interface-ip.c index 6efc3c5..e14a154 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -49,6 +49,7 @@ enum { ROUTE_ONLINK, ROUTE_TYPE, ROUTE_PROTO, + ROUTE_DISABLED, __ROUTE_MAX }; @@ -65,6 +66,7 @@ static const struct blobmsg_policy route_attr[__ROUTE_MAX] = { [ROUTE_ONLINK] = { .name = "onlink", .type = BLOBMSG_TYPE_BOOL }, [ROUTE_TYPE] = { .name = "type", .type = BLOBMSG_TYPE_STRING }, [ROUTE_PROTO] = { .name = "proto", .type = BLOBMSG_TYPE_STRING }, + [ROUTE_DISABLED] = { .name = "disabled", .type = BLOBMSG_TYPE_BOOL }, }; const struct uci_blob_param_list route_attr_list = { @@ -400,6 +402,9 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) blobmsg_parse(route_attr, __ROUTE_MAX, tb, blobmsg_data(attr), blobmsg_data_len(attr)); + if ((cur = tb[ROUTE_DISABLED]) != NULL && blobmsg_get_bool(cur)) + return; + if (!iface) { if ((cur = tb[ROUTE_INTERFACE]) == NULL) return;