From: Stephen Hemminger <stephen@networkplumber.org>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: David Ahern <dsahern@gmail.com>, Roopa Prabhu <roopa@nvidia.com>,
Nikolay Aleksandrov <nikolay@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
bridge@lists.linux-foundation.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, andrew@lunn.ch,
f.fainelli@gmail.com, vivien.didelot@gmail.com,
jiri@mellanox.com, idosch@idosch.org
Subject: Re: [RFC PATCH iproute2] bridge: add support for L2 multicast groups
Date: Thu, 22 Oct 2020 12:52:20 -0700 [thread overview]
Message-ID: <20201022125220.45c24b30@hermes.local> (raw)
In-Reply-To: <20201017184526.2333840-1-vladimir.oltean@nxp.com>
On Sat, 17 Oct 2020 21:45:26 +0300
Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> Extend the 'bridge mdb' command for the following syntax:
> bridge mdb add dev br0 port swp0 grp 01:02:03:04:05:06 permanent
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
> bridge/mdb.c | 54 ++++++++++++++++++++++++++--------
> include/uapi/linux/if_bridge.h | 2 ++
> 2 files changed, 43 insertions(+), 13 deletions(-)
>
> diff --git a/bridge/mdb.c b/bridge/mdb.c
> index 4cd7ca762b78..af160250928e 100644
> --- a/bridge/mdb.c
> +++ b/bridge/mdb.c
> @@ -149,6 +149,7 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
> struct nlmsghdr *n, struct rtattr **tb)
> {
> const void *grp, *src;
> + const char *addr;
> SPRINT_BUF(abuf);
> const char *dev;
> int af;
> @@ -156,9 +157,16 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
> if (filter_vlan && e->vid != filter_vlan)
> return;
>
> - af = e->addr.proto == htons(ETH_P_IP) ? AF_INET : AF_INET6;
> - grp = af == AF_INET ? (const void *)&e->addr.u.ip4 :
> - (const void *)&e->addr.u.ip6;
> + if (!e->addr.proto) {
> + af = AF_PACKET;
> + grp = (const void *)&e->addr.u.mac_addr;
> + } else if (e->addr.proto == htons(ETH_P_IP)) {
> + af = AF_INET;
> + grp = (const void *)&e->addr.u.ip4;
> + } else {
> + af = AF_INET6;
> + grp = (const void *)&e->addr.u.ip6;
> + }
> dev = ll_index_to_name(ifindex);
>
In C casts of pointer to void are not necessary.
prev parent reply other threads:[~2020-10-22 19:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-17 18:45 [RFC PATCH iproute2] bridge: add support for L2 multicast groups Vladimir Oltean
2020-10-22 19:52 ` Stephen Hemminger [this message]
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=20201022125220.45c24b30@hermes.local \
--to=stephen@networkplumber.org \
--cc=andrew@lunn.ch \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=idosch@idosch.org \
--cc=jiri@mellanox.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=roopa@nvidia.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.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).