From patchwork Tue Apr 9 03:41:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Donald X-Patchwork-Id: 1921189 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=CHGq5zaE; 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=az7RutAC; 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 4VDBgf6hqGz1yYH for ; Tue, 9 Apr 2024 13:45:34 +1000 (AEST) 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=CHGq5zaE8JaAml GW3lFgfAVS3SZ6msfgXRQr/5SkFaGKaSYZxt7umu3TJ7eMQEZoTy1lkvhSobALBTS75NItPc5tYiC 1pMz2TlZ7z/qG/ibpVsesHHmrSMqDjT4swi9MaYIj0Wilx1GKCAqIkBbxsyi8IFaYfjDb2gRO6G+Z 0KkjhuKDOM5PT5uXNy/Ed0I3g+kBKpKFHGEl/ODr09ahfpjm1Ibcy/lE4YCdmoxNQdoH2IoypW/xh i9Dyl9xKoge5Vm9oT+XSxJvtx8YkKAK6lBwWSCuIHtnnt4FNLEEcJw8hCccA2Crz8p5XRCWxULK91 MsSE6HZ1cIk0AdMJtScg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru2PH-00000000CKC-1ahy; Tue, 09 Apr 2024 03:44:23 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru2P4-00000000CEV-2fpS for openwrt-devel@lists.openwrt.org; Tue, 09 Apr 2024 03:44:12 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2d886f17740so20405061fa.1 for ; Mon, 08 Apr 2024 20:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712634248; x=1713239048; 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=az7RutACFfRqqVH7m+gBNcVt+e0eyyM0+Or5AlcwpoWNyEBPhPMrzmQ/UJnVk8MI6T O/jSGRBXKbyncjQKXVtS2NkngSOF8f9nX2xk+AakC4CwonluSvCJYg5NArZzp+QgTgAK VUogrHi8v0hwJisNfpBZc10AU/s8uKuTiJpdFyjodKLLm+CvpevUeiOJTMpA8wyWonvL fLbOMGfD91/mch6dFndentzl08vRA6GLW4ZH8iixS/A8H90SMJwNNKCPSEreOCx44iru jw9p/rdZuz0Hf+NIZC64uqqsySybCZBSwnDxjNGt2ycZVkjpKEMVZQmUSiOb/qFYZwNL rcdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712634248; x=1713239048; 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=WCOjSTAVJ+EA9UrqsYEOCIS5durAqmFWx3DJ2I84cwS48eYeYLWKkd8ntQNupilcdS +zOcNXjyZike09d3dyRryso1WuHm+3oVRMx3B/tb4h7N7T58nzgQEufE1+t53KBOvqNQ mD4jhcZ4ujF62cUb/mD9SGsnwZrtNKbEkei9G+38gvRd90BujKPwMOf88nO0yDqwJ6Eu /aRmGivx+JY1CclsHrfNS8z/e5DqODmTDar799Gt1dVGt8EnsiX1uVOrQh5KkpMgs6sy tWHF1QEvL65pKoG88vwLKrqGK0qvxypxIg9TP5MfxFRbup/JkE9cDfw1ChBSuewl3MvI 085w== X-Gm-Message-State: AOJu0YzN5g73iPLLk+4SJcYqwnTJqmXZCMgmVNnDImSQIMFcIyk0M5D5 Hb9R/b4Rw1Cb1X0QANelZ08omHywnJh/RrYfpzU9UpHNNrVtjTmkj6FQbirQ X-Google-Smtp-Source: AGHT+IGlpd4ey4DYmCY2xil0i1eqNDYWkNM1P6TnR2X8mRISmQghPdqzeq9VkVnAZZGixse3ZOoCuQ== X-Received: by 2002:a2e:7c13:0:b0:2d6:f8d7:ab95 with SMTP id x19-20020a2e7c13000000b002d6f8d7ab95mr339283ljc.21.1712634247943; Mon, 08 Apr 2024 20:44:07 -0700 (PDT) Received: from blackhol3 ([2001:9b0:40::cae3:cb03]) by smtp.gmail.com with ESMTPSA id n9-20020a2e86c9000000b002d2191e20e1sm1374790ljj.92.2024.04.08.20.44.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 20:44:06 -0700 (PDT) From: Paul Donald To: OpenWrt Development List Subject: [PATCH v2 2/7] lldpd: get_config_cid_ifaces() -> get_interface_csv_pattern() Date: Tue, 9 Apr 2024 05:41:02 +0200 Message-ID: <20240409034405.78194-3-newtwen+github@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240409034405.78194-1-newtwen+github@gmail.com> References: <20240402130221.58706-1-newtwen+github@gmail.com> <20240409034405.78194-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-20240408_204410_700056_D13D2C77 X-CRM114-Status: GOOD ( 10.74 ) 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:234 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_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_AU Message has a valid DKIM or DK signature from author's domain -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"