Skip to contentSkip to conversation

Staging: batman-adv for 2.6.37 (4)

B.A.T.M.A.N. New Sven Eckelmann 1 participant 8 messages Oct 19, 2010 Staging

lore
Share & tools
lore
#0 lore raw

Hi,

here are patches targeted for 2.6.37. All patches needed for that patchset are already part of your staging-next tree.

All patches are cleanup and bugfix patches and no new feature is added.

thanks,
Sven

Linus Lüssing (1):
Staging: batman-adv: Fix resizing of broadcast seqno buffers on if deletion

Marek Lindner (4):
Staging: batman-adv: document fragmentation sysfs API
Staging: batman-adv: protect against ogm packet overflow by checking table length
Staging: batman-adv: fix crash when new OGM is generated
Staging: batman-adv: process OGMs bigger than MAX_AGGREGATION_BYTES

Sven Eckelmann (2):
Staging: batman-adv: Add hash recommendations to TODO
Staging: batman-adv: Don't dereference unchecked incoming soft_iface

 drivers/staging/batman-adv/TODO                 |    4 ++++
 drivers/staging/batman-adv/aggregation.c        |   17 +++++++++++------
 drivers/staging/batman-adv/originator.c         |    4 ++--
 drivers/staging/batman-adv/send.c               |    7 +++++--
 drivers/staging/batman-adv/sysfs-class-net-mesh |    8 ++++++++
 drivers/staging/batman-adv/translation-table.c  |    9 +++++++--
 6 files changed, 37 insertions(+), 12 deletions(-)
#1 lore raw

PATCH 1/7 Staging: batman-adv: Add hash recommendations to TODO

David Miller <[email protected]> recommended in [email protected] that we must make the hash abstraction helper more efficient and may remove it completely.

---
 drivers/staging/batman-adv/TODO |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/staging/batman-adv/TODO +4 -0
index 5913731..11c384f 100644
@@ -1,3 +1,7 @@
+ * remove own list functionality from hash
+ * use hlist_head, hlist_node in hash
+ * don't use callbacks for compare+choose in hash
+ * think about more efficient ways instead of abstraction of hash
  * Request a new review
  * Process the comments from the review
  * Move into mainline proper
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/7 Staging: batman-adv: Don't dereference unchecked incoming soft_iface

In reply to Sven Eckelmann

send_packet derefenced forw_packet->if_incoming and checked if forw_packet->if_incoming is NULL.

This cannot happen, but still makes irritates when reading through the functions.

---
 drivers/staging/batman-adv/send.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/staging/batman-adv/send.c +5 -2
index 5d57ef5..9032861 100644
@@ -160,8 +160,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
 static void send_packet(struct forw_packet *forw_packet)
 {
 	struct batman_if *batman_if;
-	struct net_device *soft_iface = forw_packet->if_incoming->soft_iface;
-	struct bat_priv *bat_priv = netdev_priv(soft_iface);
+	struct net_device *soft_iface;
+	struct bat_priv *bat_priv;
 	struct batman_packet *batman_packet =
 		(struct batman_packet *)(forw_packet->skb->data);
 	unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0);
@@ -172,6 +172,9 @@ static void send_packet(struct forw_packet *forw_packet)
 		return;
 	}
 
+	soft_iface = forw_packet->if_incoming->soft_iface;
+	bat_priv = netdev_priv(soft_iface);
+
 	if (forw_packet->if_incoming->if_status != IF_ACTIVE)
 		return;
 
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 3/7 Staging: batman-adv: Fix resizing of broadcast seqno buffers on if deletion

In reply to Sven Eckelmann

From: Linus Lüssing <[email protected]>

Not only the entries of the deleted interface got erased, but also all ones with a lower if_num. This commit fixes this issue by setting the destination appropriately.

---
 drivers/staging/batman-adv/originator.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/batman-adv/originator.c +2 -2
index c530df1..865211d 100644
@@ -456,7 +456,7 @@ static int orig_node_del_if(struct orig_node *orig_node,
 	memcpy(data_ptr, orig_node->bcast_own, del_if_num * chunk_size);
 
 	/* copy second part */
-	memcpy(data_ptr,
+	memcpy(data_ptr + del_if_num * chunk_size,
 	       orig_node->bcast_own + ((del_if_num + 1) * chunk_size),
 	       (max_if_num - del_if_num) * chunk_size);
 
@@ -476,7 +476,7 @@ free_bcast_own:
 	memcpy(data_ptr, orig_node->bcast_own_sum,
 	       del_if_num * sizeof(uint8_t));
 
-	memcpy(data_ptr,
+	memcpy(data_ptr + del_if_num * sizeof(uint8_t),
 	       orig_node->bcast_own_sum + ((del_if_num + 1) * sizeof(uint8_t)),
 	       (max_if_num - del_if_num) * sizeof(uint8_t));
 
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 4/7 Staging: batman-adv: document fragmentation sysfs API

In reply to Sven Eckelmann

From: Marek Lindner <[email protected]>

---
 drivers/staging/batman-adv/sysfs-class-net-mesh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/staging/batman-adv/sysfs-class-net-mesh +8 -0
index 5aa1912..b4cdb60 100644
@@ -14,6 +14,14 @@ Description:
                 mesh will be sent using multiple interfaces at the
                 same time (if available).
 
+What:           /sys/class/net/<mesh_iface>/mesh/fragmentation
+Date:           October 2010
+Contact:        Andreas Langer <[email protected]>
+Description:
+                Indicates whether the data traffic going through the
+                mesh will be fragmented or silently discarded if the
+                packet size exceeds the outgoing interface MTU.
+
 What:           /sys/class/net/<mesh_iface>/mesh/orig_interval
 Date:           May 2010
 Contact:        Marek Lindner <[email protected]>
Signature · 1 line
1.7.2.3
#5 lore raw

PATCH 5/7 Staging: batman-adv: protect against ogm packet overflow by checking table length

In reply to Sven Eckelmann

From: Marek Lindner <[email protected]>

---
 drivers/staging/batman-adv/translation-table.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/staging/batman-adv/translation-table.c +7 -2
index 12b2325..681ccbd 100644
@@ -59,6 +59,7 @@ void hna_local_add(struct net_device *soft_iface, uint8_t *addr)
 	struct hna_global_entry *hna_global_entry;
 	struct hashtable_t *swaphash;
 	unsigned long flags;
+	int required_bytes;
 
 	spin_lock_irqsave(&bat_priv->hna_lhash_lock, flags);
 	hna_local_entry =
@@ -74,8 +75,12 @@ void hna_local_add(struct net_device *soft_iface, uint8_t *addr)
 	/* only announce as many hosts as possible in the batman-packet and
 	   space in batman_packet->num_hna That also should give a limit to
 	   MAC-flooding. */
-	if ((bat_priv->num_local_hna + 1 > (ETH_DATA_LEN - BAT_PACKET_LEN)
-								/ ETH_ALEN) ||
+	required_bytes = (bat_priv->num_local_hna + 1) * ETH_ALEN;
+	required_bytes += BAT_PACKET_LEN;
+
+	if ((required_bytes > ETH_DATA_LEN) ||
+	    (atomic_read(&bat_priv->aggregation_enabled) &&
+	     required_bytes > MAX_AGGREGATION_BYTES) ||
 	    (bat_priv->num_local_hna + 1 > 255)) {
 		bat_dbg(DBG_ROUTES, bat_priv,
 			"Can't add new local hna entry (%pM): "
Signature · 1 line
1.7.2.3
#6 lore raw

PATCH 6/7 Staging: batman-adv: fix crash when new OGM is generated

In reply to Sven Eckelmann

From: Marek Lindner <[email protected]>

If aggregation is not enabled the local translation table can grow much bigger and expects to fill a full ethernet packet.

---
 drivers/staging/batman-adv/aggregation.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/staging/batman-adv/aggregation.c +8 -2
index 46b9c2b..16b268e 100644
@@ -123,8 +123,14 @@ static void new_aggregated_packet(unsigned char *packet_buff, int packet_len,
 		return;
 	}
 
-	forw_packet_aggr->skb = dev_alloc_skb(MAX_AGGREGATION_BYTES +
-					      sizeof(struct ethhdr));
+	if ((atomic_read(&bat_priv->aggregation_enabled)) &&
+	    (packet_len < MAX_AGGREGATION_BYTES))
+		forw_packet_aggr->skb = dev_alloc_skb(MAX_AGGREGATION_BYTES +
+						      sizeof(struct ethhdr));
+	else
+		forw_packet_aggr->skb = dev_alloc_skb(packet_len +
+						      sizeof(struct ethhdr));
+
 	if (!forw_packet_aggr->skb) {
 		if (!own_packet)
 			atomic_inc(&bat_priv->batman_queue_left);
Signature · 1 line
1.7.2.3
#7 lore raw

PATCH 7/7 Staging: batman-adv: process OGMs bigger than MAX_AGGREGATION_BYTES

In reply to Sven Eckelmann

From: Marek Lindner <[email protected]>

---
 drivers/staging/batman-adv/aggregation.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/staging/batman-adv/aggregation.c +3 -4
index 16b268e..08624d4 100644
@@ -257,9 +257,7 @@ void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
 
 	batman_packet = (struct batman_packet *)packet_buff;
 
-	while (aggregated_packet(buff_pos, packet_len,
-				 batman_packet->num_hna)) {
-
+	do {
 		/* network to host order for our 32bit seqno, and the
 		   orig_interval. */
 		batman_packet->seqno = ntohl(batman_packet->seqno);
@@ -272,5 +270,6 @@ void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
 		buff_pos += BAT_PACKET_LEN + hna_len(batman_packet);
 		batman_packet = (struct batman_packet *)
 			(packet_buff + buff_pos);
-	}
+	} while (aggregated_packet(buff_pos, packet_len,
+				   batman_packet->num_hna));
 }
Signature · 1 line
1.7.2.3