From patchwork Tue Apr 2 13:02:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1918789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=gGOz5wWE; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=eMQL4mu3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V87PM3Kxmz1yYB for ; Wed, 3 Apr 2024 00:04:07 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H8TQBvg6a6HHpTmd9P2xDdwAMF7gwLb1/tiadVCMI3E=; b=gGOz5wWEjSw6AW 2OZSwtt/PBwSnANssu7rE6VDnaypXfVWoVA1y5u2sydys1T3iANW45cHwNmDUH+Iqb7bNC/ML1cuZ N71lO6N6YKzYp4DoOqSgaa6WjVpXsP7hF9glDs8IBUPv7g7V4yBRkk2N92lYYl93InD8Xs7it649f U4OHCGrbiB/wveks/jqcfrpechx+ei5PYmPLIi5dJkFvv5fb6onDIlcxMW+Sx4hNAmlHvcmDKwJgf B2SG8SlNsz+HPvocWc3myz+EE/Cy1q7zyeFx1yqYWshAZP+cKTILwLBuI8pXwXsegbqTJlbfJ+7Nh kT+hKuolqd6ojnb5gIAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdmm-0000000BDUF-4305; Tue, 02 Apr 2024 13:02:44 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrdmb-0000000BDPr-0F2m for openwrt-devel@lists.openwrt.org; Tue, 02 Apr 2024 13:02:34 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-513e10a4083so5869873e87.1 for ; Tue, 02 Apr 2024 06:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712062943; x=1712667743; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=1cPpNGRd3aQpDMj64WCShILYivWahJKI2FdD8yWr6e8=; b=eMQL4mu3bA2/WcSp22NHJvMJnhQ+gwLf0iU+HqCmhq+CugF1ayOF7Brqe1e9niCoGD m0Xo1V22j3KVU0hIwCF0xZG2CTpTN4MPII/fycgGxam1Gs495Djo1+BncH6u5dKHtYLg ToPnaJlqurSzRApYP9hSg6mrgJH1FrZDwMp0n/gR5Y0BpE8Cwjm/0FtRgKela2DhXiyk F9wuinVtCbSqioXW3Uvv3NSb8icX8kinLj9sOVn+ppjOOPmDEKJL41eUYipMXwOxUyZq d+DPtJT3be7vOh62jfyPAI+e3tXFnx4Laj9iD4TEvxADzs6SAICfl0o1V5Ro1L9C5fgh qytQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712062943; x=1712667743; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=1cPpNGRd3aQpDMj64WCShILYivWahJKI2FdD8yWr6e8=; b=QnmITWjaSod876Abe+QeUx1dibGYYabr4AMEu+sCJcImRuYLfOWEpe8Ljge72fmTZM xcyTdAhHImI/FKyby9TFJfhQWeXiwrgZ/wzsMVzdHnwT0nmfY+uveWnVB4ymQefAuP66 fokCHGUYFuqnMvY43ATSeNFo79zSIX2+lwoIpcGTENKgujWIOK0aJoU7TTnGx42oSLvQ Kz0SYpWgvIhQ4oQ9EUVeC9oxWB46L46i6fDw+iWxbyPNnRD7+wIL6zccfZeJPf7c5VHV Qxg/wBcAz/zsc6meL/vAsD8TKtQnKbAfjkSnf4LSR6OSdCoRPADVXGthwLGpYgTjWEaJ RFzQ== X-Gm-Message-State: AOJu0YzGY3DLix6hhuQtgb/hSn8fT80rT8S+/3TbboQJGn2aXdpA371L lWEpJGgAZPTnbUiywPvHKaS2HuGtm/4V1xjxBPDd0VYxxgEAKc3X71mllvYX X-Google-Smtp-Source: AGHT+IFZHmbTpdiO31avheRXXDwh5X90njF8omRm8zlQ1a84+wWiUoG1F3CJhLQUTf70+SBY+V6xnw== X-Received: by 2002:ac2:599a:0:b0:513:d08b:3790 with SMTP id w26-20020ac2599a000000b00513d08b3790mr7169860lfn.49.1712062942764; Tue, 02 Apr 2024 06:02:22 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id d8-20020ac241c8000000b00515fc468f45sm995071lfi.31.2024.04.02.06.02.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 06:02:22 -0700 (PDT) From: Paul Donald To: openwrt-devel@lists.openwrt.org Subject: [PATCH 2/7] lldpd: get_config_cid_ifaces() -> get_interface_csv_pattern() Date: Tue, 2 Apr 2024 15:02:16 +0200 Message-ID: <20240402130221.58706-2-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402130221.58706-1-newtwen+github@gmail.com> References: <20240402130221.58706-1-newtwen+github@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240402_060233_223644_4DB84F25 X-CRM114-Status: UNSURE ( 9.92 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Make the function more generic. Can use it for not only 'config'. Now it can be used to parse interfaces for additional lldpd settings Tested on: 22.03.6 Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:130 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [newtwen+github(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Make the function more generic. Can use it for not only 'config'. Now it can be used to parse interfaces for additional lldpd settings Tested on: 22.03.6 Signed-off-by: Paul Donald --- package/network/services/lldpd/files/lldpd.init | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index fc53520c5b..069c8fee80 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -75,10 +75,10 @@ get_config_restart_hash() { export -n "$var=$_hash" } -get_config_cid_ifaces() { +get_interface_csv_pattern() { set -o noglob local _ifaces - config_get _ifaces 'config' "$2" + config_get _ifaces "$2" "$3" local _iface _ifnames="" for _iface in $_ifaces; do @@ -115,7 +115,7 @@ write_lldpd_conf() config_get lldp_hostname 'config' 'lldp_hostname' "$(cat /proc/sys/kernel/hostname)" local ifnames - get_config_cid_ifaces ifnames "interface" + get_interface_csv_pattern ifnames 'config' "interface" local lldp_mgmt_ip config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip' @@ -327,7 +327,7 @@ start_service() { # ChassisID interfaces local ifnames - get_config_cid_ifaces ifnames "cid_interface" + get_interface_csv_pattern ifnames 'config' "cid_interface" [ -n "$ifnames" ] && procd_append_param command -C "$ifnames"