b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@web.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: "Linus Lüssing" <linus.luessing@ascom.ch>
Subject: [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: Allow promiscuous reception of unicast packets
Date: Sun,  7 Nov 2010 17:45:59 +0100	[thread overview]
Message-ID: <1289148361-16019-2-git-send-email-linus.luessing@web.de> (raw)
In-Reply-To: <1289148361-16019-1-git-send-email-linus.luessing@web.de>

From: Linus Lüssing <linus.luessing@ascom.ch>

A very mobile node may want to enable this to increase the probability
of unicast data reception on the last hop, especially when such a mobile
node moves towards the sender.

The mobile node needs to place its hard-interfaces utilized by
batman-adv into promisc-mode to let this optimization take effect. Be
aware, that doing so will cost your devices more processing power.

It also increases the probability of succesful reception a lot, if there
are (multiple) shorter, alternate but slightly "worse" paths, too. As
WiFi is a broadcast medium, there can be a quite good chance to receive
a packet from one of the nodes on the path to the receiver already.

Luckily batman-adv is running in kernelspace, therefore it does not make
much of a performance difference, even on embedded devices.

To let this feature take effect, place your WiFi interface in
promiscuous mode (e.g. 'ip link set wlan0 promisc on'/'ifconfig wlan0
promisc').

Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch>
---
 routing.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/routing.c b/routing.c
index e75337d..b61821a 100644
--- a/routing.c
+++ b/routing.c
@@ -1124,7 +1124,7 @@ static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
 
 	/* not for me */
 	if (!is_my_mac(ethhdr->h_dest))
-		return -1;
+		return 1;
 
 	return 0;
 }
@@ -1214,8 +1214,10 @@ int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if)
 {
 	struct unicast_packet *unicast_packet;
 	int hdr_size = sizeof(struct unicast_packet);
+	int check_ret;
 
-	if (check_unicast_packet(skb, hdr_size) < 0)
+	check_ret = check_unicast_packet(skb, hdr_size);
+	if (check_ret < 0)
 		return NET_RX_DROP;
 
 	unicast_packet = (struct unicast_packet *)skb->data;
@@ -1226,6 +1228,9 @@ int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if)
 		return NET_RX_SUCCESS;
 	}
 
+	if (check_ret)
+		return NET_RX_DROP;
+
 	return route_unicast_packet(skb, recv_if, hdr_size);
 }
 
@@ -1235,9 +1240,10 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if)
 	struct unicast_frag_packet *unicast_packet;
 	int hdr_size = sizeof(struct unicast_frag_packet);
 	struct sk_buff *new_skb = NULL;
-	int ret;
+	int ret, check_ret;
 
-	if (check_unicast_packet(skb, hdr_size) < 0)
+	check_ret = check_unicast_packet(skb, hdr_size);
+	if (check_ret < 0)
 		return NET_RX_DROP;
 
 	unicast_packet = (struct unicast_frag_packet *)skb->data;
@@ -1259,6 +1265,9 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if)
 		return NET_RX_SUCCESS;
 	}
 
+	if (check_ret)
+		return NET_RX_DROP;
+
 	return route_unicast_packet(skb, recv_if, hdr_size);
 }
 
-- 
1.7.1


  reply	other threads:[~2010-11-07 16:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-07 16:45 [B.A.T.M.A.N.] batman-adv: promisc destination reception Linus Lüssing
2010-11-07 16:45 ` Linus Lüssing [this message]
2010-11-07 16:46 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: Generic sequence number checking for data packets Linus Lüssing
2010-11-07 16:46 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: Add sequence number and duplicate checks for unicasts Linus Lüssing
2010-11-07 16:03   ` Sven Eckelmann
2010-11-07 16:50     ` Linus Lüssing
2010-11-10  0:48 ` [B.A.T.M.A.N.] batman-adv promisc mode, further notes and recomendations Linus Lüssing
2010-11-10  0:48 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Allow promiscuous reception of unicast packets Linus Lüssing
2010-11-10 11:06   ` Marek Lindner
2010-11-10 15:38     ` [B.A.T.M.A.N.] Antwort: " Linus Luessing
2010-11-29 20:36       ` Linus Lüssing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289148361-16019-2-git-send-email-linus.luessing@web.de \
    --to=linus.luessing@web.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=linus.luessing@ascom.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).