[B.A.T.M.A.N.] [PATCH] batman-adv: unset the TT_CLIENT_PENDING flag if the new local entry already exists
by Antonio Quartulli
When trying to add a new tt_local_entry, if such entry already exists, we have
to ensure that the TT_CLIENT_PENDING flag is not set, otherwise the entry will
be deleted soon.
Reported-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
translation-table.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/translation-table.c b/translation-table.c
index 27753a0..65de6b7 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -188,6 +188,8 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
if (tt_local_entry) {
tt_local_entry->last_seen = jiffies;
+ /* possibly unset the TT_CLIENT_PENDING flag */
+ tt_local_entry->common.flags &= ~TT_CLIENT_PENDING;
goto out;
}
--
1.7.3.4
8 years, 9 months
[B.A.T.M.A.N.] [PATCH] batman-adv: add biggest_unsigned_int(x) macro
by Antonio Quartulli
in case of dynamic type variable, it could be needed to compute at compile time
its maximal value. This macro helps in doing that for unsigned integer types
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
main.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/main.h b/main.h
index 464439f..3c58235 100644
--- a/main.h
+++ b/main.h
@@ -210,6 +210,9 @@ static inline int compare_eth(const void *data1, const void *data2)
/* Returns the smallest signed integer in two's complement with the sizeof x */
#define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u)))
+/* Returns the biggest unsigned integer with the sizeof x */
+#define biggest_unsigned_int(x) (~(x)0)
+
/* Checks if a sequence number x is a predecessor/successor of y.
* they handle overflows/underflows and can correctly check for a
* predecessor/successor unless the variable sequence number has grown by
--
1.7.3.4
8 years, 11 months
[B.A.T.M.A.N.] [PATCHv3 00/10] bridge loop avoidance II
by Simon Wunderlich
This series of patches contains the changes for the redesigned
bridge loop avoidance. The general concept is described in the wiki
[1]. I've already performed a few testcases [2] which worked fine in
my kvm environment. No crashes while running or unloading the
extension either.
This is the fourth version of the patchset, rebased on the master and
including the TT changes after the discussion with Antonio to get the
flags straight (see [3]):
* Roaming flag should only be set when the last entry moved
* clean up tt_global_add()
* remove (debug) crc global computation - it breaks more than it helps
* add debug message when committed locally
Cheers,
Simon
The git repositories can be found on git.open-mesh.org:
* blaII_rebase branch [4] contains the latest patchset
* blaII_rebase_rework branch [5] contains the latest patchset with individual patches from v2
* blaII branch in batctl [6] contains the batctl changes
Cheers,
Simon
[1] http://www.open-mesh.org/wiki/batman-adv/Bridge-loop-avoidance-II
[2] http://www.open-mesh.org/wiki/batman-adv/Bridge-loop-avoidance-Testcases
[3] http://www.open-mesh.org/wiki/2/TT-Flags
[4] http://git.open-mesh.org/?p=simon/batman-adv.git;a=shortlog;h=refs/heads/...
[5] http://git.open-mesh.org/?p=simon/batman-adv.git;a=shortlog;h=refs/heads/...
[6] http://git.open-mesh.org/?p=simon/batctl.git;a=shortlog;h=refs/heads/blaII
Simon Wunderlich (10):
batman-adv: remove old bridge loop avoidance code
batman-adv: add basic bridge loop avoidance code
batman-adv: make bridge loop avoidance switchable
batman-adv: export claim tables through debugfs
batman-adv: allow multiple entries in tt_global_entries
batman-adv: don't let backbone gateways exchange tt entries
batman-adv: add broadcast duplicate check
batman-adv: drop STP over batman
batman-adv: form groups in the bridge loop avoidance
batman-adv: add bridge loop avoidance compile option
Makefile | 2 +
Makefile.kbuild | 1 +
README | 19 +-
README.external | 1 +
bat_debugfs.c | 23 +-
bat_sysfs.c | 8 +-
bridge_loop_avoidance.c | 1594 +++++++++++++++++++++++++++++++++++++++++++++++
bridge_loop_avoidance.h | 55 ++
compat.c | 16 +-
compat.h | 3 +-
gen-compat-autoconf.sh | 1 +
hard-interface.c | 18 +-
main.c | 9 +-
main.h | 9 +-
originator.c | 3 +-
packet.h | 16 +
routing.c | 16 +
soft-interface.c | 490 +--------------
soft-interface.h | 2 -
sysfs-class-net-mesh | 9 +
translation-table.c | 415 ++++++++++---
types.h | 67 ++-
22 files changed, 2140 insertions(+), 637 deletions(-)
create mode 100644 bridge_loop_avoidance.c
create mode 100644 bridge_loop_avoidance.h
--
1.7.8.3
8 years, 11 months
[B.A.T.M.A.N.] [PATCH] batman-adv: encourage batman to take shorter routes by changing the default hop penalty
by Marek Lindner
Signed-off-by: Marek Lindner <lindner_marek(a)yahoo.de>
---
soft-interface.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/soft-interface.c b/soft-interface.c
index 2ffdc74..7548762 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -836,7 +836,7 @@ struct net_device *softif_create(const char *name)
atomic_set(&bat_priv->gw_sel_class, 20);
atomic_set(&bat_priv->gw_bandwidth, 41);
atomic_set(&bat_priv->orig_interval, 1000);
- atomic_set(&bat_priv->hop_penalty, 10);
+ atomic_set(&bat_priv->hop_penalty, 30);
atomic_set(&bat_priv->log_level, 0);
atomic_set(&bat_priv->fragmentation, 1);
atomic_set(&bat_priv->bcast_queue_left, BCAST_QUEUE_LEN);
--
1.7.5.4
8 years, 11 months
[B.A.T.M.A.N.] [RFC] batman-adv: Replace bitarray operations with bitmap [aka. lets break batman-av]
by Sven Eckelmann
bitarray.c consists mostly of functionality that is already available as part
of the standard kernel API. batman-adv could use architecture optimized code
and reduce the binary size by switching to the standard functions.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
--
This patch is completely untested. Simon and I just talked about standard
kernel bit operations and noticed that we hadn't fulfilled our promise to
remove the code that is already available in the linux kernel. So this is just
a reminder and should not be seen as a finished patch.
bat_iv_ogm.c | 5 ++-
bitarray.c | 92 +++++----------------------------------------------------
bitarray.h | 5 ---
main.h | 2 +-
routing.c | 2 +-
types.h | 4 +-
6 files changed, 15 insertions(+), 95 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 2b66dae..d026819 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -874,7 +874,8 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
seq_diff, set_mark);
tmp_neigh_node->real_packet_count =
- bit_packet_count(tmp_neigh_node->real_bits);
+ bitmap_weight(tmp_neigh_node->real_bits,
+ TQ_LOCAL_WINDOW_SIZE);
}
rcu_read_unlock();
@@ -1013,7 +1014,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
if_incoming_seqno -
batman_ogm_packet->seqno - 2);
orig_neigh_node->bcast_own_sum[if_incoming->if_num] =
- bit_packet_count(word);
+ bitmap_weight(word, TQ_LOCAL_WINDOW_SIZE);
spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock);
}
diff --git a/bitarray.c b/bitarray.c
index e63069d..8220506 100644
--- a/bitarray.c
+++ b/bitarray.c
@@ -29,95 +29,32 @@
int get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
uint32_t curr_seqno)
{
- int32_t diff, word_offset, word_num;
+ int32_t diff;
diff = last_seqno - curr_seqno;
- if (diff < 0 || diff >= TQ_LOCAL_WINDOW_SIZE) {
+ if (diff < 0 || diff >= TQ_LOCAL_WINDOW_SIZE)
return 0;
- } else {
- /* which word */
- word_num = (last_seqno - curr_seqno) / WORD_BIT_SIZE;
- /* which position in the selected word */
- word_offset = (last_seqno - curr_seqno) % WORD_BIT_SIZE;
-
- if (test_bit(word_offset, &seq_bits[word_num]))
- return 1;
- else
- return 0;
- }
+ else
+ return test_bit(diff, seq_bits);
}
/* turn corresponding bit on, so we can remember that we got the packet */
void bit_mark(unsigned long *seq_bits, int32_t n)
{
- int32_t word_offset, word_num;
-
/* if too old, just drop it */
if (n < 0 || n >= TQ_LOCAL_WINDOW_SIZE)
return;
- /* which word */
- word_num = n / WORD_BIT_SIZE;
- /* which position in the selected word */
- word_offset = n % WORD_BIT_SIZE;
-
- set_bit(word_offset, &seq_bits[word_num]); /* turn the position on */
+ set_bit(n, seq_bits); /* turn the position on */
}
/* shift the packet array by n places. */
static void bit_shift(unsigned long *seq_bits, int32_t n)
{
- int32_t word_offset, word_num;
- int32_t i;
-
if (n <= 0 || n >= TQ_LOCAL_WINDOW_SIZE)
return;
- word_offset = n % WORD_BIT_SIZE;/* shift how much inside each word */
- word_num = n / WORD_BIT_SIZE; /* shift over how much (full) words */
-
- for (i = NUM_WORDS - 1; i > word_num; i--) {
- /* going from old to new, so we don't overwrite the data we copy
- * from.
- *
- * left is high, right is low: FEDC BA98 7654 3210
- * ^^ ^^
- * vvvv
- * ^^^^ = from, vvvvv =to, we'd have word_num==1 and
- * word_offset==WORD_BIT_SIZE/2 ????? in this example.
- * (=24 bits)
- *
- * our desired output would be: 9876 5432 1000 0000
- * */
-
- seq_bits[i] =
- (seq_bits[i - word_num] << word_offset) +
- /* take the lower port from the left half, shift it left
- * to its final position */
- (seq_bits[i - word_num - 1] >>
- (WORD_BIT_SIZE-word_offset));
- /* and the upper part of the right half and shift it left to
- * its position */
- /* for our example that would be: word[0] = 9800 + 0076 =
- * 9876 */
- }
- /* now for our last word, i==word_num, we only have its "left" half.
- * that's the 1000 word in our example.*/
-
- seq_bits[i] = (seq_bits[i - word_num] << word_offset);
-
- /* pad the rest with 0, if there is anything */
- i--;
-
- for (; i >= 0; i--)
- seq_bits[i] = 0;
-}
-
-static void bit_reset_window(unsigned long *seq_bits)
-{
- int i;
- for (i = 0; i < NUM_WORDS; i++)
- seq_bits[i] = 0;
+ bitmap_shift_left(seq_bits, seq_bits, n, TQ_LOCAL_WINDOW_SIZE);
}
@@ -159,7 +96,7 @@ int bit_get_packet(void *priv, unsigned long *seq_bits,
bat_dbg(DBG_BATMAN, bat_priv,
"We missed a lot of packets (%i) !\n",
seq_num_diff - 1);
- bit_reset_window(seq_bits);
+ bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE);
if (set_mark)
bit_mark(seq_bits, 0);
return 1;
@@ -176,7 +113,7 @@ int bit_get_packet(void *priv, unsigned long *seq_bits,
bat_dbg(DBG_BATMAN, bat_priv,
"Other host probably restarted!\n");
- bit_reset_window(seq_bits);
+ bitmap_zero(seq_bits, TQ_LOCAL_WINDOW_SIZE);
if (set_mark)
bit_mark(seq_bits, 0);
@@ -186,16 +123,3 @@ int bit_get_packet(void *priv, unsigned long *seq_bits,
/* never reached */
return 0;
}
-
-/* count the hamming weight, how many good packets did we receive? just count
- * the 1's.
- */
-int bit_packet_count(const unsigned long *seq_bits)
-{
- int i, hamming = 0;
-
- for (i = 0; i < NUM_WORDS; i++)
- hamming += hweight_long(seq_bits[i]);
-
- return hamming;
-}
diff --git a/bitarray.h b/bitarray.h
index c613572..48f940d 100644
--- a/bitarray.h
+++ b/bitarray.h
@@ -22,8 +22,6 @@
#ifndef _NET_BATMAN_ADV_BITARRAY_H_
#define _NET_BATMAN_ADV_BITARRAY_H_
-#define WORD_BIT_SIZE (sizeof(unsigned long) * 8)
-
/* returns true if the corresponding bit in the given seq_bits indicates true
* and curr_seqno is within range of last_seqno */
int get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
@@ -38,7 +36,4 @@ void bit_mark(unsigned long *seq_bits, int32_t n);
int bit_get_packet(void *priv, unsigned long *seq_bits,
int32_t seq_num_diff, int set_mark);
-/* count the hamming weight, how many good packets did we receive? */
-int bit_packet_count(const unsigned long *seq_bits);
-
#endif /* _NET_BATMAN_ADV_BITARRAY_H_ */
diff --git a/main.h b/main.h
index 7f2d737..fd50c6e 100644
--- a/main.h
+++ b/main.h
@@ -65,7 +65,7 @@
#define NULL_IFINDEX 0 /* dummy ifindex used to avoid iface checks */
-#define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE)
+#define NUM_WORDS BITS_TO_LONGS(TQ_LOCAL_WINDOW_SIZE)
#define LOG_BUF_LEN 8192 /* has to be a power of 2 */
diff --git a/routing.c b/routing.c
index cf9a2f6..efd543a 100644
--- a/routing.c
+++ b/routing.c
@@ -52,7 +52,7 @@ void slide_own_bcast_window(struct hard_iface *hard_iface)
bit_get_packet(bat_priv, word, 1, 0);
orig_node->bcast_own_sum[hard_iface->if_num] =
- bit_packet_count(word);
+ bitmap_weight(word, TQ_LOCAL_WINDOW_SIZE);
spin_unlock_bh(&orig_node->ogm_cnt_lock);
}
rcu_read_unlock();
diff --git a/types.h b/types.h
index 302efb5..24c8a31 100644
--- a/types.h
+++ b/types.h
@@ -90,7 +90,7 @@ struct orig_node {
bool tt_poss_change;
uint32_t last_real_seqno;
uint8_t last_ttl;
- unsigned long bcast_bits[NUM_WORDS];
+ DECLARE_BITMAP(bcast_bits, TQ_LOCAL_WINDOW_SIZE);
uint32_t last_bcast_seqno;
struct hlist_head neigh_list;
struct list_head frag_list;
@@ -132,7 +132,7 @@ struct neigh_node {
uint8_t last_ttl;
struct list_head bonding_list;
unsigned long last_valid;
- unsigned long real_bits[NUM_WORDS];
+ DECLARE_BITMAP(real_bits, TQ_LOCAL_WINDOW_SIZE);
atomic_t refcount;
struct rcu_head rcu;
struct orig_node *orig_node;
--
1.7.7.3
8 years, 11 months
[B.A.T.M.A.N.] [PATCH] batman-adv: use ETH_ALEN instead of hardcoded numeric constants
by Antonio Quartulli
In packet.h the numeric constant 6 is used instead of the more portable ETH_ALEN
define. This patch substitute any hardcoded value with such define.
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
packet.h | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/packet.h b/packet.h
index 441f3db..3496d38 100644
--- a/packet.h
+++ b/packet.h
@@ -100,8 +100,8 @@ struct batman_ogm_packet {
struct batman_header header;
uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
uint32_t seqno;
- uint8_t orig[6];
- uint8_t prev_sender[6];
+ uint8_t orig[ETH_ALEN];
+ uint8_t prev_sender[ETH_ALEN];
uint8_t gw_flags; /* flags related to gateway class */
uint8_t tq;
uint8_t tt_num_changes;
@@ -114,8 +114,8 @@ struct batman_ogm_packet {
struct icmp_packet {
struct batman_header header;
uint8_t msg_type; /* see ICMP message types above */
- uint8_t dst[6];
- uint8_t orig[6];
+ uint8_t dst[ETH_ALEN];
+ uint8_t orig[ETH_ALEN];
uint16_t seqno;
uint8_t uid;
uint8_t reserved;
@@ -128,8 +128,8 @@ struct icmp_packet {
struct icmp_packet_rr {
struct batman_header header;
uint8_t msg_type; /* see ICMP message types above */
- uint8_t dst[6];
- uint8_t orig[6];
+ uint8_t dst[ETH_ALEN];
+ uint8_t orig[ETH_ALEN];
uint16_t seqno;
uint8_t uid;
uint8_t rr_cur;
@@ -139,16 +139,16 @@ struct icmp_packet_rr {
struct unicast_packet {
struct batman_header header;
uint8_t ttvn; /* destination translation table version number */
- uint8_t dest[6];
+ uint8_t dest[ETH_ALEN];
} __packed;
struct unicast_frag_packet {
struct batman_header header;
uint8_t ttvn; /* destination translation table version number */
- uint8_t dest[6];
+ uint8_t dest[ETH_ALEN];
uint8_t flags;
uint8_t align;
- uint8_t orig[6];
+ uint8_t orig[ETH_ALEN];
uint16_t seqno;
} __packed;
@@ -156,7 +156,7 @@ struct bcast_packet {
struct batman_header header;
uint8_t reserved;
uint32_t seqno;
- uint8_t orig[6];
+ uint8_t orig[ETH_ALEN];
} __packed;
struct vis_packet {
@@ -165,9 +165,9 @@ struct vis_packet {
uint32_t seqno; /* sequence number */
uint8_t entries; /* number of entries behind this struct */
uint8_t reserved;
- uint8_t vis_orig[6]; /* originator that announces its neighbors */
- uint8_t target_orig[6]; /* who should receive this packet */
- uint8_t sender_orig[6]; /* who sent or rebroadcasted this packet */
+ uint8_t vis_orig[ETH_ALEN]; /* originator that announces its neighbors */
+ uint8_t target_orig[ETH_ALEN]; /* who should receive this packet */
+ uint8_t sender_orig[ETH_ALEN]; /* who sent or rebroadcasted this packet */
} __packed;
struct tt_query_packet {
--
1.7.3.4
8 years, 11 months
[B.A.T.M.A.N.] [PATCH] batman-adv: pass the correct header size to interface_rx
by Antonio Quartulli
in recv_unicast_frag(), the third parameter of the interface_rx() invocation,
which is the size of the current header, is wrongly computed.
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
routing.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/routing.c b/routing.c
index f961cc5..cf8fe0a 100644
--- a/routing.c
+++ b/routing.c
@@ -990,7 +990,7 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if)
return NET_RX_SUCCESS;
interface_rx(recv_if->soft_iface, new_skb, recv_if,
- sizeof(struct unicast_packet));
+ sizeof(*unicast_packet));
return NET_RX_SUCCESS;
}
--
1.7.3.4
8 years, 12 months
[B.A.T.M.A.N.] ap_isolation issue
by Andre Courchesne
Hi,
We are trying to get OpenWRT with batman-adv 2011.4.0 to play nice using ap_isolation. However as soon as ap_isolation is turned on the meshed ap are not acessible anymore by our Linux firewall on which at least 1 ap node is physically connected. The following pastebin post shows the exact configuration and details:
http://pastebin.com/2bghWLkp
Any clues ?
Thanks,
Andre
8 years, 12 months
[B.A.T.M.A.N.] Wireless Battle Mesh v5 - Call for papers
by Marek Lindner
Wireless Battle Mesh v5 - Call for papers
=========================================
Wireless Battle Mesh v5 is at hand and it is time to bring together the
agenda. As last year's attempts to construct an agenda was well received and
provided the grounds for numerous healthy discussions the broad majority asked
for similar action. However, the number of talks is going to be reduced to
leave more time for individual discussions and testing.
Submission
==========
To allow an efficient handling of your submission, please provide the
following information and send them to me directly in form of an email:
* your name
* the type of your slot (talk/workshop/panel discussion/lightening talk)
* your topic headline
* your topic description which can brief (does not need to exceed a couple of
lines) but should provide a reasonable summary of your talk
* the dates of your stay at the event + (optional) preferred day for your slot
* length of the slot if you wish to do a workshop (all other slots will be
limited to one hour - notify me in advance if you think that is not enough for
you)
Feel free to contact me with your ideas in case you are unsure about your
topic. Last year's agenda also should be able to provide some insights:
http://battlemesh.org/BattleMeshV4/Agenda
Deadlines
=========
Submissions are accepted until and including the 16th of March. Everyone
missing this deadline still has the opportunity to apply for a lightening talk
slot. These slots can be acquired by simply contacting me during the event.
The list of registered lightening talks will be published in the battlemesh
wiki.
The final program will be made available in the aforementioned wiki during the
second week of March.
If you have any question or suggestion, please let me know.
Regards,
Marek
8 years, 12 months