[batman-adv] master: batman-adv: don't allow ECTP traffic on batman-adv (05d0f6d)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit 05d0f6dc27c21b5b781db2a8706ed3c5b704f763
Author: Simon Wunderlich <simon.wunderlich(a)s2003.tu-chemnitz.de>
Date: Sun Aug 19 20:10:09 2012 +0200
batman-adv: don't allow ECTP traffic on batman-adv
We have seen this to break networks when used with bridge loop
avoidance. As we can't see any benefit from sending these ancient frames
via our mesh, we just drop them.
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
>---------------------------------------------------------------
05d0f6dc27c21b5b781db2a8706ed3c5b704f763
soft-interface.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/soft-interface.c b/soft-interface.c
index bc0a0cd..a584f62 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -143,8 +143,10 @@ static int batadv_interface_tx(struct sk_buff *skb,
struct batadv_bcast_packet *bcast_packet;
struct vlan_ethhdr *vhdr;
__be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
- static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00,
- 0x00};
+ static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00,
+ 0x00, 0x00};
+ static const uint8_t ectp_addr[ETH_ALEN] = {0xCF, 0x00, 0x00, 0x00,
+ 0x00, 0x00};
unsigned int header_len = 0;
int data_len = skb->len, ret;
short vid __maybe_unused = -1;
@@ -177,10 +179,16 @@ static int batadv_interface_tx(struct sk_buff *skb,
/* don't accept stp packets. STP does not help in meshes.
* better use the bridge loop avoidance ...
+ *
+ * The same goes for ECTP sent at least by some Cisco Switches,
+ * it might confuse the mesh when used with bridge loop avoidance.
*/
if (batadv_compare_eth(ethhdr->h_dest, stp_addr))
goto dropped;
+ if (batadv_compare_eth(ethhdr->h_dest, ectp_addr))
+ goto dropped;
+
if (is_multicast_ether_addr(ethhdr->h_dest)) {
do_bcast = true;
10 years, 5 months
[batman-adv] master: Merge branch 'next' (9e4776e)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit 9e4776ea8507934e841281462385bb745f68d2ad
Merge: 534f242 28d246e
Author: Marek Lindner <lindner_marek(a)yahoo.de>
Date: Sat Aug 25 01:15:35 2012 +0200
Merge branch 'next'
>---------------------------------------------------------------
9e4776ea8507934e841281462385bb745f68d2ad
soft-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
10 years, 5 months
[batman-adv] next: batman-adv: swap lines to get in sync with networking branch (28d246e)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : next
>---------------------------------------------------------------
commit 28d246e324fe753e24adb93b7f843cbd5d5fcb1e
Author: Antonio Quartulli <ordex(a)autistici.org>
Date: Wed Aug 22 00:40:05 2012 +0200
batman-adv: swap lines to get in sync with networking branch
due to a merge conflict resolution handled differently in the networking branch,
we now have a small divergence between our next branch and what we already have
in net/batman-adv/ in the kernel. Since we cannot ask the kernel guys to "swap
two lines", with this patch we fix the problem in our repo
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
>---------------------------------------------------------------
28d246e324fe753e24adb93b7f843cbd5d5fcb1e
soft-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/soft-interface.c b/soft-interface.c
index 1aee7db..7b683e0 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -277,8 +277,8 @@ void batadv_interface_rx(struct net_device *soft_iface,
struct vlan_ethhdr *vhdr;
struct batadv_header *batadv_header = (struct batadv_header *)skb->data;
short vid __maybe_unused = -1;
- bool is_bcast;
__be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
+ bool is_bcast;
is_bcast = (batadv_header->packet_type == BATADV_BCAST);
10 years, 5 months
[batman-adv] master: batman-adv: Only increase refcounter once for alternate router (534f242)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit 534f242fe91911f6673633f018822bb747a1cf98
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Mon Aug 20 10:26:49 2012 +0200
batman-adv: Only increase refcounter once for alternate router
The test whether we can use a router for alternating bonding should only be
done once because it is already known that it is still usable and will not be
deleted from the list soon.
This patch addresses Coverity #712285: Unchecked return value
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
534f242fe91911f6673633f018822bb747a1cf98
routing.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/routing.c b/routing.c
index e7a4e25..1c545f6 100644
--- a/routing.c
+++ b/routing.c
@@ -549,25 +549,18 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig,
if (tmp_neigh_node->if_incoming == recv_if)
continue;
- if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
+ if (router && tmp_neigh_node->tq_avg <= router->tq_avg)
continue;
- /* if we don't have a router yet
- * or this one is better, choose it.
- */
- if ((!router) ||
- (tmp_neigh_node->tq_avg > router->tq_avg)) {
- /* decrement refcount of
- * previously selected router
- */
- if (router)
- batadv_neigh_node_free_ref(router);
+ if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
+ continue;
- router = tmp_neigh_node;
- atomic_inc_not_zero(&router->refcount);
- }
+ /* decrement refcount of previously selected router */
+ if (router)
+ batadv_neigh_node_free_ref(router);
- batadv_neigh_node_free_ref(tmp_neigh_node);
+ /* we found a better router (or at least one valid router) */
+ router = tmp_neigh_node;
}
/* use the first candidate if nothing was found. */
10 years, 5 months
[batman-adv] master: batman-adv: Check return value of try_module_get (2e66c5e)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit 2e66c5ee589f2723f8b609084b9f29199dc80e31
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Mon Aug 20 23:37:26 2012 +0200
batman-adv: Check return value of try_module_get
New operations should not be started when they need an increased module
reference counter and try_module_get failed.
This patch addresses Coverity #712284: Unchecked return value
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
2e66c5ee589f2723f8b609084b9f29199dc80e31
debugfs.c | 6 ++++--
icmp_socket.c | 12 ++++++++----
main.c | 10 ----------
main.h | 2 --
4 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/debugfs.c b/debugfs.c
index 391d4fb..bd032bc 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -99,15 +99,17 @@ int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
static int batadv_log_open(struct inode *inode, struct file *file)
{
+ if (!try_module_get(THIS_MODULE))
+ return -EBUSY;
+
nonseekable_open(inode, file);
file->private_data = inode->i_private;
- batadv_inc_module_count();
return 0;
}
static int batadv_log_release(struct inode *inode, struct file *file)
{
- batadv_dec_module_count();
+ module_put(THIS_MODULE);
return 0;
}
diff --git a/icmp_socket.c b/icmp_socket.c
index bde3cf7..5874c0e 100644
--- a/icmp_socket.c
+++ b/icmp_socket.c
@@ -42,12 +42,16 @@ static int batadv_socket_open(struct inode *inode, struct file *file)
unsigned int i;
struct batadv_socket_client *socket_client;
+ if (!try_module_get(THIS_MODULE))
+ return -EBUSY;
+
nonseekable_open(inode, file);
socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL);
-
- if (!socket_client)
+ if (!socket_client) {
+ module_put(THIS_MODULE);
return -ENOMEM;
+ }
for (i = 0; i < ARRAY_SIZE(batadv_socket_client_hash); i++) {
if (!batadv_socket_client_hash[i]) {
@@ -59,6 +63,7 @@ static int batadv_socket_open(struct inode *inode, struct file *file)
if (i == ARRAY_SIZE(batadv_socket_client_hash)) {
pr_err("Error - can't add another packet client: maximum number of clients reached\n");
kfree(socket_client);
+ module_put(THIS_MODULE);
return -EXFULL;
}
@@ -71,7 +76,6 @@ static int batadv_socket_open(struct inode *inode, struct file *file)
file->private_data = socket_client;
- batadv_inc_module_count();
return 0;
}
@@ -96,7 +100,7 @@ static int batadv_socket_release(struct inode *inode, struct file *file)
spin_unlock_bh(&socket_client->lock);
kfree(socket_client);
- batadv_dec_module_count();
+ module_put(THIS_MODULE);
return 0;
}
diff --git a/main.c b/main.c
index a4a337d..f9bcfa1 100644
--- a/main.c
+++ b/main.c
@@ -160,16 +160,6 @@ void batadv_mesh_free(struct net_device *soft_iface)
atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
}
-void batadv_inc_module_count(void)
-{
- try_module_get(THIS_MODULE);
-}
-
-void batadv_dec_module_count(void)
-{
- module_put(THIS_MODULE);
-}
-
int batadv_is_my_mac(const uint8_t *addr)
{
const struct batadv_hard_iface *hard_iface;
diff --git a/main.h b/main.h
index 6234a94..c243294 100644
--- a/main.h
+++ b/main.h
@@ -152,8 +152,6 @@ extern struct workqueue_struct *batadv_event_workqueue;
int batadv_mesh_init(struct net_device *soft_iface);
void batadv_mesh_free(struct net_device *soft_iface);
-void batadv_inc_module_count(void);
-void batadv_dec_module_count(void);
int batadv_is_my_mac(const uint8_t *addr);
struct batadv_hard_iface *
batadv_seq_print_text_primary_if_get(struct seq_file *seq);
10 years, 5 months
[batman-adv] master: batman-adv: Remove extra check in batadv_bit_get_packet (d2da57c)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit d2da57c9794662d2d1607c2142def652add65c55
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Mon Aug 20 10:26:47 2012 +0200
batman-adv: Remove extra check in batadv_bit_get_packet
batadv_bit_get_packet checks for all common situations before it decides that
the new received packet indicates that the host was restarted. This extra
condition check at the end of the function is not necessary because this
condition is always true.
This patch addresses Coverity #712296: Logically dead code
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
d2da57c9794662d2d1607c2142def652add65c55
bitarray.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/bitarray.c b/bitarray.c
index aea174c..5453b17 100644
--- a/bitarray.c
+++ b/bitarray.c
@@ -79,20 +79,17 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
* or the old packet got delayed somewhere in the network. The
* packet should be dropped without calling this function if the
* seqno window is protected.
+ *
+ * seq_num_diff <= -BATADV_TQ_LOCAL_WINDOW_SIZE
+ * or
+ * seq_num_diff >= BATADV_EXPECTED_SEQNO_RANGE
*/
- if (seq_num_diff <= -BATADV_TQ_LOCAL_WINDOW_SIZE ||
- seq_num_diff >= BATADV_EXPECTED_SEQNO_RANGE) {
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
+ "Other host probably restarted!\n");
- batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
- "Other host probably restarted!\n");
-
- bitmap_zero(seq_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
- if (set_mark)
- batadv_set_bit(seq_bits, 0);
-
- return 1;
- }
+ bitmap_zero(seq_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
+ if (set_mark)
+ batadv_set_bit(seq_bits, 0);
- /* never reached */
- return 0;
+ return 1;
}
10 years, 5 months
[batctl] master: batctl: Clear screen using ANSI escape codes (f1fff52)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batctl
On branch : master
>---------------------------------------------------------------
commit f1fff527ed6227d1986c4740b387c0ffc85117d5
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Mon Aug 20 00:08:44 2012 +0200
batctl: Clear screen using ANSI escape codes
It is not necessary to call an external binary to clear the screen of a default
unix terminal emulator. The external call using system("clear") may be used by
an attacker to get untrusted code called with an higher privilege because
batctl has to be run as using uid 0.
Reported-by: Antonio Quartulli <ordex(a)autistici.org>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
f1fff527ed6227d1986c4740b387c0ffc85117d5
functions.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/functions.c b/functions.c
index c78e408..e095fd0 100644
--- a/functions.c
+++ b/functions.c
@@ -184,7 +184,8 @@ open:
}
if (read_opt & CLR_CONT_READ)
- system("clear");
+ /* clear screen, set cursor back to 0,0 */
+ printf("\033[2J\033[0;0f");
read:
while (getline(&line_ptr, &len, fp) != -1) {
10 years, 5 months
[batman-adv] master: batman-adv: Set special lockdep classes to avoid lockdep warning (e27bb6f)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
>---------------------------------------------------------------
commit e27bb6fa916451e9eaced16e7c21d5b71a3b7f30
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Mon Aug 20 09:03:59 2012 +0200
batman-adv: Set special lockdep classes to avoid lockdep warning
Transmissions over batman-adv devices always start another nested transmission
over devices attached to the batman-adv interface. These devices usually use
the ethernet lockdep class for the tx_queue lock which is also set by default
for all batman-adv devices. Lockdep will detect a nested locking attempt of two
locks with the same class and warn about a possible deadlock.
This is the default and expected behavior and should not alarm the locking
correctness prove mechanism. Therefore, the locks for all netdevice specific tx
queues get a special batman-adv lock class to avoid a false positive for each
transmission.
Reported-by: Linus Luessing <linus.luessing(a)web.de>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
e27bb6fa916451e9eaced16e7c21d5b71a3b7f30
soft-interface.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/soft-interface.c b/soft-interface.c
index 1aee7db..909ab54 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -354,6 +354,26 @@ static const struct net_device_ops batadv_netdev_ops = {
.ndo_validate_addr = eth_validate_addr
};
+/* batman-adv network devices have devices nesting below it and are a special
+ * "super class" of normal network devices; split their locks off into a
+ * separate class since they always nest.
+ */
+static struct lock_class_key batadv_netdev_xmit_lock_key;
+static struct lock_class_key batadv_netdev_addr_lock_key;
+
+static void batadv_set_lockdep_class_one(struct net_device *dev,
+ struct netdev_queue *txq,
+ void *_unused)
+{
+ lockdep_set_class(&txq->_xmit_lock, &batadv_netdev_xmit_lock_key);
+}
+
+static void batadv_set_lockdep_class(struct net_device *dev)
+{
+ lockdep_set_class(&dev->addr_list_lock, &batadv_netdev_addr_lock_key);
+ netdev_for_each_tx_queue(dev, batadv_set_lockdep_class_one, NULL);
+}
+
static void batadv_interface_setup(struct net_device *dev)
{
struct batadv_priv *priv = netdev_priv(dev);
@@ -363,6 +383,7 @@ static void batadv_interface_setup(struct net_device *dev)
dev->netdev_ops = &batadv_netdev_ops;
dev->destructor = free_netdev;
dev->tx_queue_len = 0;
+ batadv_set_lockdep_class(dev);
/* can't call min_mtu, because the needed variables
* have not been initialized yet
10 years, 5 months
[linux-merge]linux integration; annotated tag, batman-adv-for-davem, updated. batman-adv-for-davem
by postmaster@open-mesh.org
The annotated tag, batman-adv-for-davem has been updated
to c7c602bd2b72cfd8fb4c679126aa16113ad51537 (tag)
from b4d92f6d3993df6e3f725b2cefc30e2d128f3e47 (which is now obsolete)
tagging fa4f0afcf40361bf67ed3abd520a5fbe12d11166 (commit)
replaces v3.6-rc2
tagged by Antonio Quartulli
on Thu Aug 23 14:34:58 2012 +0200
- Shortlog ------------------------------------------------------------
Included changes:
- a set of codestyle rearrangements/fixes
- new feature to early detect new joining (mesh-unaware) clients
- a minor fix for the gw-feature
- substitution of shift operations with the BIT() macro
- reorganization of the main batman-adv structure (struct batadv_priv)
- some more (very) minor cleanups and fixes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
iEYEABECAAYFAlA2I3gACgkQpGgxIkP9cwcp6QCfc0CcxNdBUJREotieDf5WeO1n
3igAn374RxKRQKfz5w8Vrn2Vz99w5im6
=lWCK
-----END PGP SIGNATURE-----
Antonio Quartulli (5):
batman-adv: move function arguments on one line
batman-adv: add reference counting for type batadv_tt_orig_list_entry
batman-adv: fix typos in comments
batman-adv: detect not yet announced clients
batman-adv: change interface_rx to get orig node
Jonathan Corbet (1):
batman-adv: remove a misleading comment
Marek Lindner (1):
batman-adv: convert remaining packet counters to per_cpu_ptr() infrastructure
Martin Hundebøll (2):
batman-adv: Move batadv_check_unicast_packet()
batman-adv: Drop tt queries with foreign dest
Simon Wunderlich (4):
batman-adv: Add the backbone gateway list to debugfs
batman-adv: correct comments in bridge loop avoidance
batman-adv: rename bridge loop avoidance claim types
batman-adv: check batadv_orig_hash_add_if() return code
Sven Eckelmann (5):
batman-adv: Split batadv_priv in sub-structures for features
batman-adv: Use BIT(x) macro to calculate bit positions
batman-adv: Don't break statements after assignment operator
batman-adv: Reduce accumulated length of simple statements
batman-adv: Start new development cycle
-----------------------------------------------------------------------
--
linux integration
10 years, 5 months