From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, roopa@cumulusnetworks.com,
bridge@lists.linux-foundation.org,
Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Subject: [PATCH net-next 3/4] net: bridge: mdb: dump host-joined entries as well
Date: Wed, 14 Aug 2019 17:40:23 +0300 [thread overview]
Message-ID: <20190814144024.9710-4-nikolay@cumulusnetworks.com> (raw)
In-Reply-To: <20190814144024.9710-1-nikolay@cumulusnetworks.com>
Currently we dump only the port mdb entries but we can have host-joined
entries on the bridge itself and they should be treated as normal temp
mdbs, they're already notified:
$ bridge monitor all
[MDB]dev br0 port br0 grp ff02::8 temp
The group will not be shown in the bridge mdb output, but it takes 1 slot
and it's timing out. If it's only host-joined then the mdb show output
can even be empty.
After this patch we show the host-joined groups:
$ bridge mdb show
dev br0 port br0 grp ff02::8 temp
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
net/bridge/br_mdb.c | 41 +++++++++++++++++++++++++++++++----------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 77730983097e..985273425117 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -78,22 +78,35 @@ static void __mdb_entry_to_br_ip(struct br_mdb_entry *entry, struct br_ip *ip)
}
static int __mdb_fill_info(struct sk_buff *skb,
+ struct net_bridge_mdb_entry *mp,
struct net_bridge_port_group *p)
{
+ struct timer_list *mtimer;
struct nlattr *nest_ent;
struct br_mdb_entry e;
+ u8 flags = 0;
+ int ifindex;
memset(&e, 0, sizeof(e));
- __mdb_entry_fill_flags(&e, p->flags);
- e.ifindex = p->port->dev->ifindex;
- e.vid = p->addr.vid;
- if (p->addr.proto == htons(ETH_P_IP))
- e.addr.u.ip4 = p->addr.u.ip4;
+ if (p) {
+ ifindex = p->port->dev->ifindex;
+ mtimer = &p->timer;
+ flags = p->flags;
+ } else {
+ ifindex = mp->br->dev->ifindex;
+ mtimer = &mp->timer;
+ }
+
+ __mdb_entry_fill_flags(&e, flags);
+ e.ifindex = ifindex;
+ e.vid = mp->addr.vid;
+ if (mp->addr.proto == htons(ETH_P_IP))
+ e.addr.u.ip4 = mp->addr.u.ip4;
#if IS_ENABLED(CONFIG_IPV6)
- if (p->addr.proto == htons(ETH_P_IPV6))
- e.addr.u.ip6 = p->addr.u.ip6;
+ if (mp->addr.proto == htons(ETH_P_IPV6))
+ e.addr.u.ip6 = mp->addr.u.ip6;
#endif
- e.addr.proto = p->addr.proto;
+ e.addr.proto = mp->addr.proto;
nest_ent = nla_nest_start_noflag(skb,
MDBA_MDB_ENTRY_INFO);
if (!nest_ent)
@@ -102,7 +115,7 @@ static int __mdb_fill_info(struct sk_buff *skb,
if (nla_put_nohdr(skb, sizeof(e), &e) ||
nla_put_u32(skb,
MDBA_MDB_EATTR_TIMER,
- br_timer_value(&p->timer))) {
+ br_timer_value(mtimer))) {
nla_nest_cancel(skb, nest_ent);
return -EMSGSIZE;
}
@@ -139,12 +152,20 @@ static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb,
break;
}
+ if (mp->host_joined) {
+ err = __mdb_fill_info(skb, mp, NULL);
+ if (err) {
+ nla_nest_cancel(skb, nest2);
+ break;
+ }
+ }
+
for (pp = &mp->ports; (p = rcu_dereference(*pp)) != NULL;
pp = &p->next) {
if (!p->port)
continue;
- err = __mdb_fill_info(skb, p);
+ err = __mdb_fill_info(skb, mp, p);
if (err) {
nla_nest_cancel(skb, nest2);
goto out;
--
2.21.0
next prev parent reply other threads:[~2019-08-14 14:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-14 14:40 [PATCH net-next 0/4] net: bridge: mdb: allow dump/add/del of host-joined entries Nikolay Aleksandrov
2019-08-14 14:40 ` [PATCH net-next 1/4] net: bridge: mdb: move vlan comments Nikolay Aleksandrov
2019-08-14 14:40 ` [PATCH net-next 2/4] net: bridge: mdb: factor out mdb filling Nikolay Aleksandrov
2019-08-14 14:40 ` Nikolay Aleksandrov [this message]
2019-08-14 14:40 ` [PATCH net-next 4/4] net: bridge: mdb: allow add/delete for host-joined groups Nikolay Aleksandrov
2019-08-14 16:01 ` [PATCH net-next 0/4] net: bridge: mdb: allow dump/add/del of host-joined entries Nikolay Aleksandrov
2019-08-14 17:04 ` [PATCH net-next v2 " Nikolay Aleksandrov
2019-08-14 17:04 ` [PATCH net-next v2 1/4] net: bridge: mdb: move vlan comments Nikolay Aleksandrov
2019-08-14 17:04 ` [PATCH net-next v2 2/4] net: bridge: mdb: factor out mdb filling Nikolay Aleksandrov
2019-08-14 17:05 ` [PATCH net-next v2 3/4] net: bridge: mdb: dump host-joined entries as well Nikolay Aleksandrov
2019-08-14 17:05 ` [PATCH net-next v2 4/4] net: bridge: mdb: allow add/delete for host-joined groups Nikolay Aleksandrov
2019-08-16 20:04 ` [PATCH net-next v2 0/4] net: bridge: mdb: allow dump/add/del of host-joined entries David Miller
2019-08-17 11:22 ` [PATCH net-next v3 " Nikolay Aleksandrov
2019-08-17 11:22 ` [PATCH net-next v3 1/4] net: bridge: mdb: move vlan comments Nikolay Aleksandrov
2019-08-17 11:22 ` [PATCH net-next v3 2/4] net: bridge: mdb: factor out mdb filling Nikolay Aleksandrov
2019-08-17 11:22 ` [PATCH net-next v3 3/4] net: bridge: mdb: dump host-joined entries as well Nikolay Aleksandrov
2019-08-17 11:22 ` [PATCH net-next v3 4/4] net: bridge: mdb: allow add/delete for host-joined groups Nikolay Aleksandrov
2019-08-17 19:37 ` [PATCH net-next v3 0/4] net: bridge: mdb: allow dump/add/del of host-joined entries David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190814144024.9710-4-nikolay@cumulusnetworks.com \
--to=nikolay@cumulusnetworks.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).