From patchwork Sun Jan 30 04:39:15 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: 810 Return-Path: Received: from fmmailgate01.web.de (fmmailgate01.web.de [217.72.192.221]) by open-mesh.org (Postfix) with ESMTP id E9607154638 for ; Sun, 30 Jan 2011 05:39:43 +0100 (CET) Received: from smtp07.web.de ( [172.20.5.215]) by fmmailgate01.web.de (Postfix) with ESMTP id DF5541867F44B; Sun, 30 Jan 2011 05:39:43 +0100 (CET) Received: from [46.126.246.98] (helo=localhost) by smtp07.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.110 #2) id 1PjP4h-0007el-00; Sun, 30 Jan 2011 05:39:43 +0100 From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 30 Jan 2011 05:39:15 +0100 Message-Id: <1296362366-3852-8-git-send-email-linus.luessing@saxnet.de> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1296362366-3852-1-git-send-email-linus.luessing@saxnet.de> References: <1296362366-3852-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: V01U2FsdGVkX1/Ud33/e7mlLnWxrpRGlVZQG2kyjcGnL4elynEf Iqp7dRfJZdo2cwJCYkpogMkbK9DMUi8BQtuxyLUZLcFDdSx9tS LsX8asvEV8J9TwHRsT4A== Cc: =?UTF-8?q?Linus=20L=C3=BCssing?= Subject: [B.A.T.M.A.N.] [PATCH 07/18] batman-adv: Route multicast tracker packets 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: Sun, 30 Jan 2011 04:39:44 -0000 This commit adds the ability to also forward a received multicast tracker packet (if necessary). It also makes use of the same splitting methods introduced with one of the previous commits, in case of multiple next hop destinations. Signed-off-by: Linus Lüssing --- hard-interface.c | 5 +++++ routing.c | 20 ++++++++++++++++++++ routing.h | 1 + 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/batman-adv/hard-interface.c b/batman-adv/hard-interface.c index 1455e7f..8fa8ff7 100644 --- a/batman-adv/hard-interface.c +++ b/batman-adv/hard-interface.c @@ -631,6 +631,11 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, ret = recv_bcast_packet(skb, batman_if); break; + /* multicast tracker packet */ + case BAT_MCAST_TRACKER: + ret = recv_mcast_tracker_packet(skb, batman_if); + break; + /* vis packet */ case BAT_VIS: ret = recv_vis_packet(skb, batman_if); diff --git a/batman-adv/routing.c b/batman-adv/routing.c index 81719d9..60dcf39 100644 --- a/batman-adv/routing.c +++ b/batman-adv/routing.c @@ -35,6 +35,7 @@ #include "gateway_common.h" #include "gateway_client.h" #include "unicast.h" +#include "multicast.h" void slide_own_bcast_window(struct batman_if *batman_if) { @@ -1496,6 +1497,25 @@ out: return ret; } +int recv_mcast_tracker_packet(struct sk_buff *skb, struct batman_if *recv_if) +{ + struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); + int hdr_size = sizeof(struct mcast_tracker_packet); + + /* keep skb linear */ + if (skb_linearize(skb) < 0) + return NET_RX_DROP; + + if (check_unicast_packet(skb, hdr_size) < 0) + return NET_RX_DROP; + + route_mcast_tracker_packet(skb, bat_priv); + + dev_kfree_skb(skb); + + return NET_RX_SUCCESS; +} + int recv_vis_packet(struct sk_buff *skb, struct batman_if *recv_if) { struct vis_packet *vis_packet; diff --git a/batman-adv/routing.h b/batman-adv/routing.h index d138644..83f2752 100644 --- a/batman-adv/routing.h +++ b/batman-adv/routing.h @@ -38,6 +38,7 @@ int recv_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if); +int recv_mcast_tracker_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_vis_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_bat_packet(struct sk_buff *skb, struct batman_if *recv_if); struct neigh_node *find_router(struct bat_priv *bat_priv,