Re: [B.A.T.M.A.N.] [PATCH 18/20] batman-adv: Still flood multicast packets we are not a receiver of

Andrew Lunn
2010-12-10T13:07:52Z

On Tue, Dec 07, 2010 at 11:32:28PM +0100, Linus L??ssing wrote:
> We may only optimize the multicast packet flow, if an mcast_mode has been
> activated and if we are a multicast receiver of the same group. Otherwise
> flood the multicast packet without optimizations.
>
> This allows us to still flood multicast packets of protocols where it is
> not easily possible for a multicast sender to be a multicast receiver of
> the same group instead of dropping them (for instance IPv6 NDP).
>
> This commit therefore also makes IPv6 usable again, if the
> proact_tracking multicast mode has been activated.
>
> Signed-off-by: Linus L??ssing <linus.luessing@saxnet.de>
> ---
> multicast.c | 25 +++++++++++++++++++++++++
> multicast.h | 1 +
> soft-interface.c | 2 +-
> 3 files changed, 27 insertions(+), 1 deletions(-)
>
> diff --git a/multicast.c b/multicast.c
> index 042d392..1f84f7c 100644
> --- a/multicast.c
> +++ b/multicast.c
> @@ -107,6 +107,31 @@ void mcast_tracker_reset(struct bat_priv *bat_priv)
> start_mcast_tracker(bat_priv);
> }
>
> +inline int mcast_may_optimize(uint8_t *dest, struct net_device *soft_iface) {
> + MC_LIST *mc_entry;
> + unsigned long flags;
> + struct bat_priv *bat_priv = netdev_priv(soft_iface);
> + int mcast_mode = atomic_read(&bat_priv->mcast_mode);
> +

> --- a/soft-interface.c
> +++ b/soft-interface.c
> @@ -391,7 +391,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
>
> if (is_broadcast_ether_addr(ethhdr->h_dest))
> bcast_dst = true;
> - else if (atomic_read(&bat_priv->mcast_mode) == MCAST_MODE_PROACT_TRACKING)
> + else if (mcast_may_optimize(ethhdr->h_dest, soft_iface))
> mcast_dst = true;
> else
> bcast_dst = true;

You define mcast_may_optimize as inline, and then use it from a
different file. This makes the inline pointless, as far as i know.

Andrew