Re: [RFC PATCH iproute2] bridge: add support for L2 multicast groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 17 Oct 2020 21:45:26 +0300
Vladimir Oltean <vladimir.oltean@xxxxxxx> 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@xxxxxxx>
> ---
>  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.



[Index of Archives]     [Netdev]     [AoE Tools]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux