All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] batman-adv multi-hop route
@ 2010-10-25  4:03 Xianghua Xiao
  2010-10-25 12:48 ` Marek Lindner
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Xianghua Xiao @ 2010-10-25  4:03 UTC (permalink / raw)
  To: b.a.t.m.a.n

I'm trying to test how much bandwidth is left after multi-hops using
dual-radio as the backbone(interface alternating), I have a few nodes
and want to force them cascaded, is there a way to set up 'static hop
route' somehow so the nodes will not take a short-cut, the nodes are
all close-by.

Basically I want to have A->B->C->D->E and avoid A->E or something alike.

thanks,
xianghua

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [B.A.T.M.A.N.] batman-adv multi-hop route
  2010-10-25  4:03 [B.A.T.M.A.N.] batman-adv multi-hop route Xianghua Xiao
@ 2010-10-25 12:48 ` Marek Lindner
  2010-10-25 22:06 ` Linus Lüssing
  2010-10-25 22:06 ` [B.A.T.M.A.N.] [PATCH] batman-adv: Adding netfilter-bridge hooks Linus Lüssing
  2 siblings, 0 replies; 9+ messages in thread
From: Marek Lindner @ 2010-10-25 12:48 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking,
	Linus Lüssing

On Monday 25 October 2010 06:03:01 Xianghua Xiao wrote:
> I'm trying to test how much bandwidth is left after multi-hops using
> dual-radio as the backbone(interface alternating), I have a few nodes
> and want to force them cascaded, is there a way to set up 'static hop
> route' somehow so the nodes will not take a short-cut, the nodes are
> all close-by.
> 
> Basically I want to have A->B->C->D->E and avoid A->E or something alike.

You could remove the external antennas (if any) to reduce the signal strength. 
That is much easier than a software solution. Alternatively you can use 
ebtables to block unwanted OGMs. Linus might be of help here.

Regards,
Marek

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [B.A.T.M.A.N.] batman-adv multi-hop route
  2010-10-25  4:03 [B.A.T.M.A.N.] batman-adv multi-hop route Xianghua Xiao
  2010-10-25 12:48 ` Marek Lindner
@ 2010-10-25 22:06 ` Linus Lüssing
  2010-10-25 22:16   ` Xianghua Xiao
  2010-10-25 22:06 ` [B.A.T.M.A.N.] [PATCH] batman-adv: Adding netfilter-bridge hooks Linus Lüssing
  2 siblings, 1 reply; 9+ messages in thread
From: Linus Lüssing @ 2010-10-25 22:06 UTC (permalink / raw)
  To: b.a.t.m.a.n

Hi xianghua,

for such test cases basically this patch had once been made to force batman-adv
onto certain routes but needed to be removed again as the way ebtables is
used here is not standard-conforming. However, this shouldn't bother you :).

You can then just use ebtables to prohibit certain routes:
> ebtables -I INPUT -s MAC -j DROP or
> ebtables -I INPUT -p 0x4305 -j DROP
> (and the same for -I OUTPUT)

Antonio had been doing tests with this ebtables patch, too (see this
mailing list's archive from about the 10 May 2010).

This is a revert of the revert of commit 660d20261343e0b2ff57e51e50d7eb0e557d5e5b.
and applies on top of the current git master branch. If you need it for any
other version of batman-adv, try 'git revert 660d20261343e0b2ff57e51e50d7eb0e557d5e5b'
and if that doesn't work, just bug me again :).

Cheers, Linus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [B.A.T.M.A.N.] [PATCH] batman-adv: Adding netfilter-bridge hooks
  2010-10-25  4:03 [B.A.T.M.A.N.] batman-adv multi-hop route Xianghua Xiao
  2010-10-25 12:48 ` Marek Lindner
  2010-10-25 22:06 ` Linus Lüssing
@ 2010-10-25 22:06 ` Linus Lüssing
  2 siblings, 0 replies; 9+ messages in thread
From: Linus Lüssing @ 2010-10-25 22:06 UTC (permalink / raw)
  To: b.a.t.m.a.n

batman-adv is receiving and sending the packets of its own ether type
on a very early/low level. Therefore we need to add explicit hooks to
give netfilter/ebtables a chance to filter them.

//git revert 660d20261343e0b2ff57e51e50d7eb0e557d5e5b

//Signed-off-by: Linus Lüssing <linus.luessing@web.de>
//Reported-by: Antonio Quartulli <ordex@ritirata.org>
---
 hard-interface.c |   70 ++++++++++++++++++++++++++++++------------------------
 send.c           |    8 ++++-
 2 files changed, 45 insertions(+), 33 deletions(-)

diff --git a/hard-interface.c b/hard-interface.c
index ef95680..9153b19 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -30,6 +30,7 @@
 #include "hash.h"
 
 #include <linux/if_arp.h>
+#include <linux/netfilter_bridge.h>
 
 #include "compat.h"
 
@@ -539,46 +540,29 @@ out:
 	return NOTIFY_DONE;
 }
 
-/* receive a packet with the batman ethertype coming on a hard
- * interface */
-int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
-	struct packet_type *ptype, struct net_device *orig_dev)
+static int batman_skb_recv_finish(struct sk_buff *skb)
 {
-	struct bat_priv *bat_priv;
 	struct batman_packet *batman_packet;
 	struct batman_if *batman_if;
+	struct bat_priv *bat_priv;
 	int ret;
 
-	batman_if = container_of(ptype, struct batman_if, batman_adv_ptype);
-	skb = skb_share_check(skb, GFP_ATOMIC);
-
-	/* skb was released by skb_share_check() */
-	if (!skb)
-		goto err_out;
-
-	/* packet should hold at least type and version */
-	if (unlikely(!pskb_may_pull(skb, 2)))
+	batman_if = get_batman_if_by_netdev(skb->dev);
+	if (!batman_if)
 		goto err_free;
 
-	/* expect a valid ethernet header here. */
-	if (unlikely(skb->mac_len != sizeof(struct ethhdr)
-				|| !skb_mac_header(skb)))
+	if (!batman_if->soft_iface)
 		goto err_free;
 
-	if (!batman_if->soft_iface)
+	/* discard frames on not active interfaces */
+	if (batman_if->if_status != IF_ACTIVE)
 		goto err_free;
 
 	bat_priv = netdev_priv(batman_if->soft_iface);
-
 	if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
 		goto err_free;
 
-	/* discard frames on not active interfaces */
-	if (batman_if->if_status != IF_ACTIVE)
-		goto err_free;
-
 	batman_packet = (struct batman_packet *)skb->data;
-
 	if (batman_packet->version != COMPAT_VERSION) {
 		bat_dbg(DBG_BATMAN, bat_priv,
 			"Drop packet: incompatible batman version (%i)\n",
@@ -624,18 +608,42 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
 	}
 
 	if (ret == NET_RX_DROP)
-		kfree_skb(skb);
+		goto err_free;
+
+	return 0;
 
-	/* return NET_RX_SUCCESS in any case as we
-	 * most probably dropped the packet for
-	 * routing-logical reasons. */
+err_free:
+	kfree_skb(skb);
+	return 0;
+}
 
-	return NET_RX_SUCCESS;
+/* receive a packet with the batman ethertype coming on a hard
+ * interface */
+int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
+	struct packet_type *ptype, struct net_device *orig_dev)
+{
+	skb = skb_share_check(skb, GFP_ATOMIC);
 
+	/* skb was released by skb_share_check() */
+	if (!skb)
+		return 0;
+
+	/* packet should hold at least type and version */
+	if (unlikely(!pskb_may_pull(skb, 2)))
+		goto err_free;
+
+	/* expect a valid ethernet header here. */
+	if (unlikely(skb->mac_len != sizeof(struct ethhdr) ||
+	    !skb_mac_header(skb)))
+		goto err_free;
+
+	/* if netfilter/ebtables wants to block incoming batman
+	 * packets then give them a chance to do so here */
+	return NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, dev,
+		       NULL, batman_skb_recv_finish);
 err_free:
 	kfree_skb(skb);
-err_out:
-	return NET_RX_DROP;
+	return 0;
 }
 
 struct notifier_block hard_if_notifier = {
diff --git a/send.c b/send.c
index a96a786..11a009f 100644
--- a/send.c
+++ b/send.c
@@ -30,6 +30,7 @@
 #include "aggregation.h"
 #include "gateway_common.h"
 #include "originator.h"
+#include <linux/netfilter_bridge.h>
 
 #include "compat.h"
 
@@ -95,9 +96,12 @@ int send_skb_packet(struct sk_buff *skb,
 
 	/* dev_queue_xmit() returns a negative result on error.	 However on
 	 * congestion and traffic shaping, it drops and returns NET_XMIT_DROP
-	 * (which is > 0). This will not be treated as an error. */
+	 * (which is > 0). This will not be treated as an error.
+	 * Also, if netfilter/ebtables wants to block outgoing batman
+	 * packets then giving them a chance to do so here */
 
-	return dev_queue_xmit(skb);
+	return NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
+		       dev_queue_xmit);
 send_skb_err:
 	kfree_skb(skb);
 	return NET_XMIT_DROP;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [B.A.T.M.A.N.] batman-adv multi-hop route
  2010-10-25 22:06 ` Linus Lüssing
@ 2010-10-25 22:16   ` Xianghua Xiao
  2010-10-28  1:17     ` Xianghua Xiao
  0 siblings, 1 reply; 9+ messages in thread
From: Xianghua Xiao @ 2010-10-25 22:16 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking,
	linus.luessing

On Mon, Oct 25, 2010 at 5:06 PM, Linus Lüssing <linus.luessing@web.de> wrote:
> Hi xianghua,
>
> for such test cases basically this patch had once been made to force batman-adv
> onto certain routes but needed to be removed again as the way ebtables is
> used here is not standard-conforming. However, this shouldn't bother you :).
>
> You can then just use ebtables to prohibit certain routes:
>> ebtables -I INPUT -s MAC -j DROP or
>> ebtables -I INPUT -p 0x4305 -j DROP
>> (and the same for -I OUTPUT)
>
> Antonio had been doing tests with this ebtables patch, too (see this
> mailing list's archive from about the 10 May 2010).
>
> This is a revert of the revert of commit 660d20261343e0b2ff57e51e50d7eb0e557d5e5b.
> and applies on top of the current git master branch. If you need it for any
> other version of batman-adv, try 'git revert 660d20261343e0b2ff57e51e50d7eb0e557d5e5b'
> and if that doesn't work, just bug me again :).
>
> Cheers, Linus
>

Thanks!
Will give it a try.
Xianghua

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [B.A.T.M.A.N.] batman-adv multi-hop route
  2010-10-25 22:16   ` Xianghua Xiao
@ 2010-10-28  1:17     ` Xianghua Xiao
  2010-10-28  2:02       ` Xianghua Xiao
  0 siblings, 1 reply; 9+ messages in thread
From: Xianghua Xiao @ 2010-10-28  1:17 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking,
	linus.luessing

On Mon, Oct 25, 2010 at 5:16 PM, Xianghua Xiao <xiaoxianghua@gmail.com> wrote:
> On Mon, Oct 25, 2010 at 5:06 PM, Linus Lüssing <linus.luessing@web.de> wrote:
>> Hi xianghua,
>>
>> for such test cases basically this patch had once been made to force batman-adv
>> onto certain routes but needed to be removed again as the way ebtables is
>> used here is not standard-conforming. However, this shouldn't bother you :).
>>
>> You can then just use ebtables to prohibit certain routes:
>>> ebtables -I INPUT -s MAC -j DROP or
>>> ebtables -I INPUT -p 0x4305 -j DROP
>>> (and the same for -I OUTPUT)
>>
>> Antonio had been doing tests with this ebtables patch, too (see this
>> mailing list's archive from about the 10 May 2010).
>>
>> This is a revert of the revert of commit 660d20261343e0b2ff57e51e50d7eb0e557d5e5b.
>> and applies on top of the current git master branch. If you need it for any
>> other version of batman-adv, try 'git revert 660d20261343e0b2ff57e51e50d7eb0e557d5e5b'
>> and if that doesn't work, just bug me again :).
>>
>> Cheers, Linus
>>
>
> Thanks!
> Will give it a try.
> Xianghua
>
************A*******************
$ git revert 660d20261343e0b2ff57e51e50d7eb0e557d5e5b
Automatic revert failed.  After resolving the conflicts,
mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
and commit the result.
************B*********************
$ git diff
diff --cc send.c
index 16ffd03,283c6bb..0000000
--- a/send.c
+++ b/send.c
@@@ -28,6 -28,8 +28,11 @@@
  #include "types.h"
  #include "vis.h"
  #include "aggregation.h"
++<<<<<<< HEAD
++=======
+ #include "gateway_common.h"
+ #include <linux/netfilter_bridge.h>
++>>>>>>> 660d202... batman-adv: Revert "Adding netfilter-bridge hooks"

  #include "compat.h"
****************C*********************
$cat send.c
<snip>
#include "main.h"
#include "send.h"
#include "routing.h"
#include "translation-table.h"
#include "soft-interface.h"
#include "hard-interface.h"
#include "types.h"
#include "vis.h"
#include "aggregation.h"
#include "gateway_common.h"
#include <linux/netfilter_bridge.h>

#include "compat.h"
<snip>
****************D*********************
~/devel/mesh/batman-adv$ make
make -C /lib/modules/2.6.32-25-generic/build
REVISION=v2010.1.0-52-gdbfbc90-dirty
M=/home/xxiao/devel/mesh/batman-adv
PWD=/home/xxiao/devel/mesh/batman-adv -j 1 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-25-generic'
  CC [M]  /home/xxiao/devel/mesh/batman-adv/main.o
  CC [M]  /home/xxiao/devel/mesh/batman-adv/bat_debugfs.o
  CC [M]  /home/xxiao/devel/mesh/batman-adv/bat_sysfs.o
  CC [M]  /home/xxiao/devel/mesh/batman-adv/send.o
/home/xxiao/devel/mesh/batman-adv/send.c:31:28: error:
gateway_common.h: No such file or directory
make[2]: *** [/home/xxiao/devel/mesh/batman-adv/send.o] Error 1
make[1]: *** [_module_/home/xxiao/devel/mesh/batman-adv] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-25-generic'
make: *** [all] Error 2

so, where is gateway_common.h?

thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [B.A.T.M.A.N.] batman-adv multi-hop route
  2010-10-28  1:17     ` Xianghua Xiao
@ 2010-10-28  2:02       ` Xianghua Xiao
  2010-10-28 11:58         ` Linus Lüssing
  0 siblings, 1 reply; 9+ messages in thread
From: Xianghua Xiao @ 2010-10-28  2:02 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking,
	linus.luessing

On Wed, Oct 27, 2010 at 8:17 PM, Xianghua Xiao <xiaoxianghua@gmail.com> wrote:
> On Mon, Oct 25, 2010 at 5:16 PM, Xianghua Xiao <xiaoxianghua@gmail.com> wrote:
>> On Mon, Oct 25, 2010 at 5:06 PM, Linus Lüssing <linus.luessing@web.de> wrote:
>>> Hi xianghua,
>>>
>>> for such test cases basically this patch had once been made to force batman-adv
>>> onto certain routes but needed to be removed again as the way ebtables is
>>> used here is not standard-conforming. However, this shouldn't bother you :).
>>>
>>> You can then just use ebtables to prohibit certain routes:
>>>> ebtables -I INPUT -s MAC -j DROP or
>>>> ebtables -I INPUT -p 0x4305 -j DROP
>>>> (and the same for -I OUTPUT)
>>>
>>> Antonio had been doing tests with this ebtables patch, too (see this
>>> mailing list's archive from about the 10 May 2010).
>>>
>>> This is a revert of the revert of commit 660d20261343e0b2ff57e51e50d7eb0e557d5e5b.
>>> and applies on top of the current git master branch. If you need it for any
>>> other version of batman-adv, try 'git revert 660d20261343e0b2ff57e51e50d7eb0e557d5e5b'
>>> and if that doesn't work, just bug me again :).
>>>
>>> Cheers, Linus
>>>
>>
>> Thanks!
>> Will give it a try.
>> Xianghua
>>
> ************A*******************
> $ git revert 660d20261343e0b2ff57e51e50d7eb0e557d5e5b
> Automatic revert failed.  After resolving the conflicts,
> mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
> and commit the result.
> ************B*********************
> $ git diff
> diff --cc send.c
> index 16ffd03,283c6bb..0000000
> --- a/send.c
> +++ b/send.c
> @@@ -28,6 -28,8 +28,11 @@@
>  #include "types.h"
>  #include "vis.h"
>  #include "aggregation.h"
> ++<<<<<<< HEAD
> ++=======
> + #include "gateway_common.h"
> + #include <linux/netfilter_bridge.h>
> ++>>>>>>> 660d202... batman-adv: Revert "Adding netfilter-bridge hooks"
>
>  #include "compat.h"
> ****************C*********************
> $cat send.c
> <snip>
> #include "main.h"
> #include "send.h"
> #include "routing.h"
> #include "translation-table.h"
> #include "soft-interface.h"
> #include "hard-interface.h"
> #include "types.h"
> #include "vis.h"
> #include "aggregation.h"
> #include "gateway_common.h"
> #include <linux/netfilter_bridge.h>
>
> #include "compat.h"
> <snip>
> ****************D*********************
> ~/devel/mesh/batman-adv$ make
> make -C /lib/modules/2.6.32-25-generic/build
> REVISION=v2010.1.0-52-gdbfbc90-dirty
> M=/home/xxiao/devel/mesh/batman-adv
> PWD=/home/xxiao/devel/mesh/batman-adv -j 1 modules
> make[1]: Entering directory `/usr/src/linux-headers-2.6.32-25-generic'
>  CC [M]  /home/xxiao/devel/mesh/batman-adv/main.o
>  CC [M]  /home/xxiao/devel/mesh/batman-adv/bat_debugfs.o
>  CC [M]  /home/xxiao/devel/mesh/batman-adv/bat_sysfs.o
>  CC [M]  /home/xxiao/devel/mesh/batman-adv/send.o
> /home/xxiao/devel/mesh/batman-adv/send.c:31:28: error:
> gateway_common.h: No such file or directory
> make[2]: *** [/home/xxiao/devel/mesh/batman-adv/send.o] Error 1
> make[1]: *** [_module_/home/xxiao/devel/mesh/batman-adv] Error 2
> make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-25-generic'
> make: *** [all] Error 2
>
> so, where is gateway_common.h?
>
> thanks!
>

sent out too fast, I removed that offending line and it compiles. never mind.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [B.A.T.M.A.N.] batman-adv multi-hop route
  2010-10-28  2:02       ` Xianghua Xiao
@ 2010-10-28 11:58         ` Linus Lüssing
  2010-10-28 14:14           ` Xianghua Xiao
  0 siblings, 1 reply; 9+ messages in thread
From: Linus Lüssing @ 2010-10-28 11:58 UTC (permalink / raw)
  To: b.a.t.m.a.n

Hi Xianghua,

cool, great that it works now :). Let us know about any findings and
interesting results you get out if it. I'd be especially interested
if you could confirm the results of the WBMv3 in Italy and maybe
could pinpoint the more stable graph of channel alternating to less
interference / packet loss for instance.
(http://www.open-mesh.org/wiki/2010-06-13-wbm2010-bracciano).

And of course, we love to get any open feedback (both positive or negative),
that's the big advantage of Open Source development :).

Cheers,
Linus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [B.A.T.M.A.N.] batman-adv multi-hop route
  2010-10-28 11:58         ` Linus Lüssing
@ 2010-10-28 14:14           ` Xianghua Xiao
  0 siblings, 0 replies; 9+ messages in thread
From: Xianghua Xiao @ 2010-10-28 14:14 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thu, Oct 28, 2010 at 6:58 AM, Linus Lüssing <linus.luessing@ascom.ch> wrote:
> Hi Xianghua,
>
> cool, great that it works now :). Let us know about any findings and
> interesting results you get out if it. I'd be especially interested
> if you could confirm the results of the WBMv3 in Italy and maybe
> could pinpoint the more stable graph of channel alternating to less
> interference / packet loss for instance.
> (http://www.open-mesh.org/wiki/2010-06-13-wbm2010-bracciano).
>
> And of course, we love to get any open feedback (both positive or negative),
> that's the big advantage of Open Source development :).
>
> Cheers,
> Linus
>

Linus,
Will test 3 nodes(each have 2 radios at 5Ghz for backhaul) this
weekend, after that  I will report.I'm using Routerstation/openwrt for
the testing.
Xianghua

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-10-28 14:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-25  4:03 [B.A.T.M.A.N.] batman-adv multi-hop route Xianghua Xiao
2010-10-25 12:48 ` Marek Lindner
2010-10-25 22:06 ` Linus Lüssing
2010-10-25 22:16   ` Xianghua Xiao
2010-10-28  1:17     ` Xianghua Xiao
2010-10-28  2:02       ` Xianghua Xiao
2010-10-28 11:58         ` Linus Lüssing
2010-10-28 14:14           ` Xianghua Xiao
2010-10-25 22:06 ` [B.A.T.M.A.N.] [PATCH] batman-adv: Adding netfilter-bridge hooks Linus Lüssing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.