From patchwork Sat Jan 22 01:21:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 712 Return-Path: Received: from fmmailgate02.web.de (fmmailgate02.web.de [217.72.192.227]) by open-mesh.org (Postfix) with ESMTP id 8B78C15467F for ; Sat, 22 Jan 2011 02:22:25 +0100 (CET) Received: from smtp05.web.de ( [172.20.4.166]) by fmmailgate02.web.de (Postfix) with ESMTP id 72295193A05C6; Sat, 22 Jan 2011 02:22:25 +0100 (CET) Received: from [46.126.246.98] (helo=localhost) by smtp05.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #2) id 1PgSBN-0006nG-00; Sat, 22 Jan 2011 02:22:25 +0100 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 22 Jan 2011 02:21:41 +0100 Message-Id: <1295659302-7171-19-git-send-email-linus.luessing@saxnet.de> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1295659302-7171-1-git-send-email-linus.luessing@saxnet.de> References: <1295659302-7171-1-git-send-email-linus.luessing@saxnet.de> MIME-Version: 1.0 Sender: linus.luessing@web.de X-Sender: linus.luessing@web.de X-Provags-ID: V01U2FsdGVkX19iNjVrESWH9+H8+NNDGafxGVOtjcUN76/XSJKg riN6XWXK3ESKD9q7zx+CH4zWf5EfxDD9K7i3BhZdABbQmVx5Dv X5+XiSAxZ7ngUh96IbVw== Cc: =?UTF-8?q?Linus=20L=C3=BCssing?= Subject: [B.A.T.M.A.N.] [PATCH 18/19] batman-adv: Still flood multicast packets we are not a receiver of X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jan 2011 01:22:25 -0000 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 --- soft-interface.c | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/batman-adv/soft-interface.c b/batman-adv/soft-interface.c index 2f327c4..2b202ae 100644 --- a/batman-adv/soft-interface.c +++ b/batman-adv/soft-interface.c @@ -340,6 +340,31 @@ static int interface_change_mtu(struct net_device *dev, int new_mtu) return 0; } +static int mcast_may_optimize(uint8_t *dest, struct net_device *soft_iface) +{ + MC_LIST *mc_entry; + struct bat_priv *bat_priv = netdev_priv(soft_iface); + int mcast_mode = atomic_read(&bat_priv->mcast_mode); + + if (mcast_mode != MCAST_MODE_PROACT_TRACKING) + return 0; + + /* Still allow flooding of multicast packets of protocols where it is + * not easily possible for a multicast sender to be a multicast + * receiver of the same group (for instance IPv6 NDP) */ + netif_addr_lock_bh(soft_iface); + netdev_for_each_mc_addr(mc_entry, soft_iface) { + if (memcmp(dest, mc_entry->MC_LIST_ADDR, ETH_ALEN)) + continue; + + netif_addr_unlock_bh(soft_iface); + return 1; + } + netif_addr_unlock_bh(soft_iface); + + return 0; +} + int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) { struct ethhdr *ethhdr = (struct ethhdr *)skb->data; @@ -392,8 +417,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;