From patchwork Sat Mar 11 06:36:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1755682 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=EwowvI7R; dkim=fail reason="key not found in DNS" header.d=true.cz header.i=@true.cz header.a=rsa-sha256 header.s=xnet header.b=oyXUIsIL; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PYYFW11Lwz1yWp for ; Sat, 11 Mar 2023 17:40:14 +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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z32t/G9kPv62+MW61StHTCJ0+E7osnQDymRznaU4+wY=; b=EwowvI7RsvhSjC Z3gAt3xeWa8P5gxHG/Smfp6i8ZdbA4fzBsUv9y6rvAcpfbjdoIfsTYim1i4k2DTETEELqVCRLWlQs 6tgKv5V/zOR7R4OybGyIVaEy6mJfXK1bEUmsasTIfABV4QzpCnPT0W1PxVr5Y6qxgGJkkVTdK70J1 Ed9zu3VSi1Ry2zfghzUv+QNRD9vnd8YT67JguAw5V/pi3S6xsv/NoS8a98yaxEYPe06uF+MPQoStu OUFzIeMnXAHmkUF9quzftOuCsKjukZY6hozXVQDn8RJ52HEq3N3vVmPtsvceEiJkkf3R9VqrI/Xj0 1EbJ7LgRWjn443VfQo+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pasqi-00HJYR-Hg; Sat, 11 Mar 2023 06:37:00 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pasqD-00HJUI-CQ for openwrt-devel@lists.openwrt.org; Sat, 11 Mar 2023 06:36:33 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id C3B5B18B7B; Sat, 11 Mar 2023 07:36:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=true.cz; s=xnet; t=1678516583; bh=xDX9ZBESq2OZIc9U7xGE8xzallXQbgrEA8AGRMN4wXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oyXUIsILkEvBAvHaKLgLY4LkWMutM2t0IsaUVTXZS9qeDZyL+7HQPImUr7a71nzH6 em37x5Bkes+8o7265y+PWWdFyiqCEDeNzqYIJKlloacol1Cn4Nl3YHvArXKtbWEVQ+ l1y07x0OqLphs+cBo12WF5Y2KH4qpOiR/r+Kdnas= Received: by meh.true.cz (OpenSMTPD) with ESMTP id f4da4764; Sat, 11 Mar 2023 07:35:56 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Subject: [PATCH netifd 2/2] bridge: bridge_dump_info: add dumping of bridge attributes Date: Sat, 11 Mar 2023 07:36:16 +0100 Message-Id: <20230311063616.1566-3-ynezz@true.cz> In-Reply-To: <20230311063616.1566-1-ynezz@true.cz> References: <20230311063616.1566-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230310_223629_920224_225F9D2F X-CRM114-Status: UNSURE ( 7.64 ) 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: There are internal decisions being made using several bridge attributes like for example in bridge_reload(), but those attributes are not available for the outside inspection, thus hard to follow. So lets make inspection easier and simply just add dumping of those bridge attributes as well. Content analysis details: (0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -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_INVALID DKIM or DK signature exists, but is not valid 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 There are internal decisions being made using several bridge attributes like for example in bridge_reload(), but those attributes are not available for the outside inspection, thus hard to follow. So lets make inspection easier and simply just add dumping of those bridge attributes as well. Signed-off-by: Petr Štetiar --- bridge.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bridge.c b/bridge.c index 9ed7c985afef..c7ba6a785378 100644 --- a/bridge.c +++ b/bridge.c @@ -968,12 +968,15 @@ bridge_dump_vlan(struct blob_buf *b, struct bridge_vlan *vlan) static void bridge_dump_info(struct device *dev, struct blob_buf *b) { + struct bridge_config *cfg; struct bridge_state *bst; struct bridge_member *bm; struct bridge_vlan *vlan; void *list; + void *c; bst = container_of(dev, struct bridge_state, dev); + cfg = &bst->config; system_if_dump_info(dev, b); list = blobmsg_open_array(b, "bridge-members"); @@ -987,6 +990,29 @@ bridge_dump_info(struct device *dev, struct blob_buf *b) blobmsg_close_array(b, list); + c = blobmsg_open_table(b, "bridge-attributes"); + + blobmsg_add_u8(b, "stp", cfg->stp); + blobmsg_add_u32(b, "forward_delay", cfg->forward_delay); + blobmsg_add_u32(b, "priority", cfg->priority); + blobmsg_add_u32(b, "ageing_time", cfg->ageing_time); + blobmsg_add_u32(b, "hello_time", cfg->hello_time); + blobmsg_add_u32(b, "max_age", cfg->max_age); + blobmsg_add_u8(b, "igmp_snooping", cfg->igmp_snoop); + blobmsg_add_u8(b, "bridge_empty", cfg->bridge_empty); + blobmsg_add_u8(b, "multicast_querier", cfg->multicast_querier); + blobmsg_add_u32(b, "hash_max", cfg->hash_max); + blobmsg_add_u32(b, "robustness", cfg->robustness); + blobmsg_add_u32(b, "query_interval", cfg->query_interval); + blobmsg_add_u32(b, "query_response_interval", cfg->query_response_interval); + blobmsg_add_u32(b, "last_member_interval", cfg->last_member_interval); + blobmsg_add_u8(b, "vlan_filtering", cfg->vlan_filtering); + blobmsg_add_u8(b, "stp_kernel", cfg->stp_kernel); + if (cfg->stp_proto) + blobmsg_add_string(b, "stp_proto", cfg->stp_proto); + + blobmsg_close_table(b, c); + if (avl_is_empty(&dev->vlans.avl)) return;