From patchwork Mon Aug 16 10:11:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 497893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BEC4C4320A for ; Mon, 16 Aug 2021 10:11:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3AD861B3C for ; Mon, 16 Aug 2021 10:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233423AbhHPKMU (ORCPT ); Mon, 16 Aug 2021 06:12:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbhHPKMR (ORCPT ); Mon, 16 Aug 2021 06:12:17 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1515FC0613C1 for ; Mon, 16 Aug 2021 03:11:46 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id i6so25596417edu.1 for ; Mon, 16 Aug 2021 03:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yXugY6d6T5JQ0E8sNO0/q9WRH/ek0UK4wOazUv+3iLQ=; b=InZAbQ1dDJW3JUG3tm2610Sm8jfyPUYpcoztYMjP3QPX6CrHuqXMLzK/lIOG9eHXzj XVJx/WMkrNhURHBhIuAgPtMx0M2VTQGFtbGXPMiqHX0LTXPsrXntccWmbh2HPcCdGxFR +3fZIMByMt0JmSB5Ui8t7oS+NYmfP361BAjXFmW2akUzQsy8+SkBQ/IeTnqsGkXjkfrJ fMoMdlTa0b69VVL4+zS/iXRezG2yKTrMep1xPT4HwmKblqo4G81uta6epcU6LsAOvhPC DomqSU+R2nra6h9rRHZrGh1z4C532asQSdb/roM0sUsGGNQu0SYlweJA0C4y7+XSu1dU oO9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yXugY6d6T5JQ0E8sNO0/q9WRH/ek0UK4wOazUv+3iLQ=; b=gFDDY5YgEBAedJko5yQy8EV3IsDwbr/WEgQbTf5ogb3yOSEsuG9oOx5qxBAI/A4jXc 3UmEMoLbZ+Ce+5CMQpsoAmiZCdES0I3Cjpwz/zniQZ/eOHMo+q4wDBVFWAoxGtDePCRM x1WEFZCXMnTvcCmvFYD8+pWEGwNi/EewZdXxmBBb83WV8Y3qTZYIciHK7CAN8qJV9wjw SJO2Qb3+Ksa5nmCcjAeR72guTvGk2RAj0RbeaFDxK/USYXzc3GFbYT/xFWmtliuVpYEZ Zn17G9QcmfQr3P1cHfNZclF1FBJVNHmZeI9Ssrg7DleKVBKOQnPFW7nNkC/TpySGyGGx Fa6g== X-Gm-Message-State: AOAM532Zn/cnc2iTRUxSGvwImTIU52tsD+7kOZbbCMhMTfpzuP9xPloV JUbj1Fdiu95OJ7shNHMSBSCqDALrnw2jwMXa X-Google-Smtp-Source: ABdhPJxXMqyssyRDAaVHKKZHAxqRTwPslVkpP4lo0zhlzblNeZyoaadY5J41kFKz1+DE7YwIPI0EzA== X-Received: by 2002:aa7:db8b:: with SMTP id u11mr1633238edt.362.1629108704494; Mon, 16 Aug 2021 03:11:44 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id a60sm4673779edf.59.2021.08.16.03.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 03:11:44 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 1/3] net: bridge: mcast: don't dump querier state if snooping is disabled Date: Mon, 16 Aug 2021 13:11:32 +0300 Message-Id: <20210816101134.577413-2-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816101134.577413-1-razor@blackwall.org> References: <20210816101134.577413-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov A minor improvement to avoid dumping mcast ctx querier state if snooping is disabled for that context (either bridge or vlan). Signed-off-by: Nikolay Aleksandrov --- net/bridge/br_multicast.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 0e5d6ba03457..9bdf12635871 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -2943,6 +2943,10 @@ int br_multicast_dump_querier_state(struct sk_buff *skb, struct net_bridge_port *p; struct nlattr *nest; + if (!br_opt_get(brmctx->br, BROPT_MULTICAST_ENABLED) || + br_multicast_ctx_vlan_global_disabled(brmctx)) + return 0; + nest = nla_nest_start(skb, nest_attr); if (!nest) return -EMSGSIZE; From patchwork Mon Aug 16 10:11:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 497892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72A61C432BE for ; Mon, 16 Aug 2021 10:11:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D02861BA9 for ; Mon, 16 Aug 2021 10:11:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235703AbhHPKMX (ORCPT ); Mon, 16 Aug 2021 06:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbhHPKMT (ORCPT ); Mon, 16 Aug 2021 06:12:19 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 182F9C061764 for ; Mon, 16 Aug 2021 03:11:48 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id v2so15156047edq.10 for ; Mon, 16 Aug 2021 03:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hom66D7QlF74ZChwS4t+afVi3WhkjTNJBXj7NjSNFVM=; b=tzWe0JAh41Gch5AiXUler1lJGHcqpdBUfWCEMcGGoBuvpGARlOm/fBp4GAqpPZr/eg /v2jlAxpf4/MDN2h3VP8hyxcd76IvPO8N2VDN+JgQ3qg0xKxraMsW6v0VrIrxEOClZ8a nEffjvCvE2bsllavHYmQd1SPwBRHushTPBFjxy3vRyWhv48f8+xx/apSuijmabUtsO1q a/1Tt1jyHBRpsXnr5I5bPhh/uYU2JqkQrh8qp0VwurSmfVGPN3tRdTYU39bkgc1El1ip RU7F1RPlIBqriUWYGtNhHP0hr49wbmP57GjqDvgCoSdnb84jZ34lWjhMkdaxKlgHwQE3 ykIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hom66D7QlF74ZChwS4t+afVi3WhkjTNJBXj7NjSNFVM=; b=uSId2J+Ylx4mH6adZnL63q/MAJsKmQ92rRElwRavViwFhawxdnK6EwXz61MeDo3nnH ggqh2vW33D+z6XMlcGimzHcWErXu/hc3DviQpQ955/YBiA7B2gpTOYJ1TQyKTcGtZWP2 7fDHw6Id7YVqnZW3bf0qNkIi5Ni3j9dd20pMdSIO9Oz9GJ5fEah8XKRARB7lHeRkN2AO H2bq//qAPnEujxUl6AWSfHkab+tjsLUU680pLVH8oRdCbbizrW+w5pQMBpbbnxt/iDn+ VUqX1WgS+aEYvt9ulomS1tSpEylA5RWvi0byJGIavxgMi39NUa+cu+Qf9s/TJIwcmUyK VUmQ== X-Gm-Message-State: AOAM533Expeym/dSAkl/xUts6QWJIS9v5drgy+nRVcebb7WGGX5Z0M4e gz5yiuSWBKqocCSiCo2A5tflw7gyScYcXRl4 X-Google-Smtp-Source: ABdhPJw99vMmXDCLexrjgcOJFxMkdW98wBQ/KdlS/eX4xE1TFTFw04btcQSgI+FBUsmxRIGzKrUGag== X-Received: by 2002:aa7:d896:: with SMTP id u22mr19052986edq.290.1629108706486; Mon, 16 Aug 2021 03:11:46 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id a60sm4673779edf.59.2021.08.16.03.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 03:11:46 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@nvidia.com, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 3/3] net: bridge: mcast: account for ipv6 size when dumping querier state Date: Mon, 16 Aug 2021 13:11:34 +0300 Message-Id: <20210816101134.577413-4-razor@blackwall.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210816101134.577413-1-razor@blackwall.org> References: <20210816101134.577413-1-razor@blackwall.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Nikolay Aleksandrov We need to account for the IPv6 attributes when dumping querier state. Fixes: 5e924fe6ccfd ("net: bridge: mcast: dump ipv6 querier state") Signed-off-by: Nikolay Aleksandrov --- net/bridge/br_multicast.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 76992ddac7e0..e411dd814c58 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -2931,7 +2931,13 @@ size_t br_multicast_querier_state_size(void) return nla_total_size(0) + /* nest attribute */ nla_total_size(sizeof(__be32)) + /* BRIDGE_QUERIER_IP_ADDRESS */ nla_total_size(sizeof(int)) + /* BRIDGE_QUERIER_IP_PORT */ - nla_total_size_64bit(sizeof(u64)); /* BRIDGE_QUERIER_IP_OTHER_TIMER */ + nla_total_size_64bit(sizeof(u64)) + /* BRIDGE_QUERIER_IP_OTHER_TIMER */ +#if IS_ENABLED(CONFIG_IPV6) + nla_total_size(sizeof(struct in6_addr)) + /* BRIDGE_QUERIER_IPV6_ADDRESS */ + nla_total_size(sizeof(int)) + /* BRIDGE_QUERIER_IPV6_PORT */ + nla_total_size_64bit(sizeof(u64)) + /* BRIDGE_QUERIER_IPV6_OTHER_TIMER */ +#endif + 0; } /* protected by rtnl or rcu */