From patchwork Mon Sep 24 12:20:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 973917 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=dev.tdt.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K9ER48Ri"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="ELB8nVYP"; 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 42Jk7R4CN7z9sPj for ; Mon, 24 Sep 2018 22:30:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date: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=b+oKRRErdHZofTI1XnsEqSEs3zBAizrx2bQt/XeLvCQ=; b=K9ER48Ri5CHTes rTXS8wUtYGDnhULZxotsENwr7iXQDYUbwXCzs1TPeXHpN1RWYLKh3rjVOhNP38ZVGnD1akbHQFIzM pfa2X18j7dX3otxAiBJdcVtZhpYRf/TxqJQ1SKmhewcxCWP9T/qv0RgBX6eGzNnMA4/MN8SITUut2 UcYft3NoGN5RgANdmaK8R/NSG6UGvg46YU7d0coVgIJlM6+mfFzJhNjjpUwhRSFrsM1XH6CEGTdZL Kzcl5KWDVHUXw0QO9fEzKU1SwYG3uQ9Vbp0ALpqnFkZQ51NAPr+vasdTabCsRgsqt1Qygu5MoQ91J 8QHegeXG+GccZbXVlr+g==; 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 1g4Q0G-0002xF-UE; Mon, 24 Sep 2018 12:30:17 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4Pz1-00015f-ML for openwrt-devel@bombadil.infradead.org; Mon, 24 Sep 2018 12:28:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+yUy8wkTJy15lNLd9haMMX12kMNBs+jVIPZlS+2AWFg=; b=ELB8nVYP22CQwVLMcxDvpbNVj VEhLohkz3N4Y7RAdLa9qNlQzzASkT5+InyqwyO9QN3nGDBw4Kdd/YLZMZ/jlQ6EOZj9e5prtsZ6Oa S2f/Lov38H8toXh6ssmqIVlpJw+pgoJbZ7dsx/Wjbz5wUSy/GkyRZqMEwj6CHaUWzRIiy6qyLzRmU +B2tVeh7nFp8BSrL3VcPov650oCQu93GCg0jo3Ln0AoaYHiQjo6Ahvt4ywx/Il8pAVGOumJZtsqJV spstmfmUSdrDWM+Rj6eQ0b0eHH7KyK5r0C4LaEEFF0EMQzDPnEEIpfizV74A+FIaKkaoBWSqX9cE6 fnrILeVpg==; Received: from ms.tdt.de ([195.243.126.94] helo=mail.dev.tdt.de) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4Pr9-00005R-BR for openwrt-devel@lists.openwrt.org; Mon, 24 Sep 2018 12:20:53 +0000 Received: from feckert01.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id C43722003E; Mon, 24 Sep 2018 12:20:39 +0000 (UTC) From: Florian Eckert To: openwrt-devel@lists.openwrt.org Date: Mon, 24 Sep 2018 14:20:29 +0200 Message-Id: <20180924122029.1989-1-fe@dev.tdt.de> X-Mailer: git-send-email 2.11.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.dev.tdt.de X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180924_132051_409144_51D48723 X-CRM114-Status: UNSURE ( 7.37 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [OpenWrt-Devel] [PATCH] base-files: add network_get_metric() to /lib/functions/network.sh X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fe@dev.tdt.de MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Florian Eckert --- package/base-files/files/lib/functions/network.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh index d7fd2dea57..4fdcb66302 100644 --- a/package/base-files/files/lib/functions/network.sh +++ b/package/base-files/files/lib/functions/network.sh @@ -271,6 +271,11 @@ network_is_up() # 2: interface network_get_protocol() { __network_ifstatus "$1" "$2" ".proto"; } +# determine the metric of the given logical interface +# 1: destination variable +# 2: interface +network_get_metric() { __network_ifstatus "$1" "$2" ".metric"; } + # determine the layer 3 linux network device of the given logical interface # 1: destination variable # 2: interface