Skip to contentSkip to conversation

pull request: batman-adv 2011-02-12

PATCH New Sven Eckelmann 3 participants 6 messages Feb 11, 2011 – Feb 12, 2011 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

I would like propose following changes for net-next-2.6.git. Two of them are minor code style changes and the other two change minor issues in the routing/fragmentation code.

thanks,
Sven

The following changes since commit 091b948306d2628320e77977eb7ae4a757b12180:

batman-adv: Merge README of v2011.0.0 release (2011-01-31 14:57:13 +0100)

are available in the git repository at:
git://git.open-mesh.org/ecsv/linux-merge.git batman-adv/next

Linus Lüssing (2):
batman-adv: Remove duplicate types.h inclusions
batman-adv: Disallow originator addressing within mesh layer

Marek Lindner (1):
batman-adv: Split combined variable declarations

Sven Eckelmann (1):
batman-adv: Use successive sequence numbers for fragments

 net/batman-adv/icmp_socket.c       |    1 -
 net/batman-adv/icmp_socket.h       |    2 --
 net/batman-adv/main.c              |    1 -
 net/batman-adv/routing.c           |    1 -
 net/batman-adv/routing.h           |    2 --
 net/batman-adv/send.c              |    1 -
 net/batman-adv/send.h              |    2 --
 net/batman-adv/soft-interface.c    |    1 -
 net/batman-adv/translation-table.c |    1 -
 net/batman-adv/translation-table.h |    2 --
 net/batman-adv/unicast.c           |   19 +++++++------------
 11 files changed, 7 insertions(+), 26 deletions(-)

A message that is not in the archive (sent off-list or not yet received): 1297466503-13246-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org

#2 lore raw

PATCH 1/4 batman-adv: Use successive sequence numbers for fragments

The two fragments of an unicast packet must have successive sequence numbers to allow the receiver side to detect matching fragments and merge them again. The current implementation doesn't provide that property because a sequence of two atomic_inc_return may be interleaved with another sequence which also changes the variable.

The access to the fragment sequence number pool has either to be protected by correct locking or it has to reserve two sequence numbers in a single fetch. The latter one can easily be done by increasing the value of the last used sequence number by 2 in a single step. The generated window of two currently unused sequence numbers can now be scattered across the two fragments.

---
 net/batman-adv/unicast.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
net/batman-adv/unicast.c +4 -4
index cbf022c..9b2a222 100644
@@ -226,6 +226,7 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
 	int ucf_hdr_len = sizeof(struct unicast_frag_packet);
 	int data_len = skb->len - uc_hdr_len;
 	int large_tail = 0;
+	uint16_t seqno;
 
 	if (!bat_priv->primary_if)
 		goto dropped;
@@ -261,10 +262,9 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
 	frag1->flags = UNI_FRAG_HEAD | large_tail;
 	frag2->flags = large_tail;
 
-	frag1->seqno = htons((uint16_t)atomic_inc_return(
-			     &batman_if->frag_seqno));
-	frag2->seqno = htons((uint16_t)atomic_inc_return(
-			     &batman_if->frag_seqno));
+	seqno = atomic_add_return(2, &batman_if->frag_seqno);
+	frag1->seqno = htons(seqno - 1);
+	frag2->seqno = htons(seqno);
 
 	send_skb_packet(skb, batman_if, dstaddr);
 	send_skb_packet(frag_skb, batman_if, dstaddr);
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 2/4 batman-adv: Split combined variable declarations

In reply to a message not in the archive

From: Marek Lindner <[email protected]>

Multiple variable declarations in a single statements over multiple lines can be split into multiple variable declarations without changing the actual behavior.

---
 net/batman-adv/unicast.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/batman-adv/unicast.c +2 -2
index 9b2a222..6c92eef 100644
@@ -39,8 +39,8 @@ static struct sk_buff *frag_merge_packet(struct list_head *head,
 		(struct unicast_frag_packet *)skb->data;
 	struct sk_buff *tmp_skb;
 	struct unicast_packet *unicast_packet;
-	int hdr_len = sizeof(struct unicast_packet),
-	    uni_diff = sizeof(struct unicast_frag_packet) - hdr_len;
+	int hdr_len = sizeof(struct unicast_packet);
+	int uni_diff = sizeof(struct unicast_frag_packet) - hdr_len;
 
 	/* set skb to the first part and tmp_skb to the second part */
 	if (up->flags & UNI_FRAG_HEAD) {
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 3/4 batman-adv: Remove duplicate types.h inclusions

In reply to a message not in the archive

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

types.h is included by main.h, which is included at the beginning of any other c-file anyway. Therefore this commit removes those duplicate inclussions.

---
 net/batman-adv/icmp_socket.c       |    1 -
 net/batman-adv/icmp_socket.h       |    2 --
 net/batman-adv/main.c              |    1 -
 net/batman-adv/routing.c           |    1 -
 net/batman-adv/routing.h           |    2 --
 net/batman-adv/send.c              |    1 -
 net/batman-adv/send.h              |    2 --
 net/batman-adv/soft-interface.c    |    1 -
 net/batman-adv/translation-table.c |    1 -
 net/batman-adv/translation-table.h |    2 --
 10 files changed, 0 insertions(+), 14 deletions(-)
net/batman-adv/icmp_socket.c +0 -1
index 5e86d6f..319a7cc 100644
@@ -24,7 +24,6 @@
 #include <linux/slab.h>
 #include "icmp_socket.h"
 #include "send.h"
-#include "types.h"
 #include "hash.h"
 #include "originator.h"
 #include "hard-interface.h"
net/batman-adv/icmp_socket.h +0 -2
index 08b1859..462b190 100644
@@ -22,8 +22,6 @@
 #ifndef _NET_BATMAN_ADV_ICMP_SOCKET_H_
 #define _NET_BATMAN_ADV_ICMP_SOCKET_H_
 
-#include "types.h"
-
 #define ICMP_SOCKET "socket"
 
 void bat_socket_init(void);
net/batman-adv/main.c +0 -1
index dc9248d..06d956c 100644
@@ -30,7 +30,6 @@
 #include "translation-table.h"
 #include "hard-interface.h"
 #include "gateway_client.h"
-#include "types.h"
 #include "vis.h"
 #include "hash.h"
 
net/batman-adv/routing.c +0 -1
index 028f739..8274140 100644
@@ -28,7 +28,6 @@
 #include "icmp_socket.h"
 #include "translation-table.h"
 #include "originator.h"
-#include "types.h"
 #include "ring_buffer.h"
 #include "vis.h"
 #include "aggregation.h"
net/batman-adv/routing.h +0 -2
index ceeca6f..a09d16f 100644
@@ -22,8 +22,6 @@
 #ifndef _NET_BATMAN_ADV_ROUTING_H_
 #define _NET_BATMAN_ADV_ROUTING_H_
 
-#include "types.h"
-
 void slide_own_bcast_window(struct batman_if *batman_if);
 void receive_bat_packet(struct ethhdr *ethhdr,
 				struct batman_packet *batman_packet,
net/batman-adv/send.c +0 -1
index 7cc620e..8314276 100644
@@ -25,7 +25,6 @@
 #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"
net/batman-adv/send.h +0 -2
index bc53ade..b68c272 100644
@@ -22,8 +22,6 @@
 #ifndef _NET_BATMAN_ADV_SEND_H_
 #define _NET_BATMAN_ADV_SEND_H_
 
-#include "types.h"
-
 int send_skb_packet(struct sk_buff *skb,
 				struct batman_if *batman_if,
 				uint8_t *dst_addr);
net/batman-adv/soft-interface.c +0 -1
index 145e0f7..bd088f8 100644
@@ -26,7 +26,6 @@
 #include "send.h"
 #include "bat_debugfs.h"
 #include "translation-table.h"
-#include "types.h"
 #include "hash.h"
 #include "gateway_common.h"
 #include "gateway_client.h"
net/batman-adv/translation-table.c +0 -1
index f6917dd..7fb6726 100644
@@ -22,7 +22,6 @@
 #include "main.h"
 #include "translation-table.h"
 #include "soft-interface.h"
-#include "types.h"
 #include "hash.h"
 #include "originator.h"
 
net/batman-adv/translation-table.h +0 -2
index a4f3a37..f19931c 100644
@@ -22,8 +22,6 @@
 #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
 #define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
 
-#include "types.h"
-
 int hna_local_init(struct bat_priv *bat_priv);
 void hna_local_add(struct net_device *soft_iface, uint8_t *addr);
 void hna_local_remove(struct bat_priv *bat_priv,
Signature · 1 line
1.7.2.3
maintainer
#5 lore raw

PATCH 4/4 batman-adv: Disallow originator addressing within mesh layer

In reply to Sven Eckelmann

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

For a host in the mesh network, the batman layer should be transparent. However, we had one exception, data packets within the mesh network which have the same destination as a originator are being routed to that node, although there is no host that node's bat0 interface and therefore gets dropped anyway. This commit removes this exception.

---
 net/batman-adv/unicast.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
net/batman-adv/unicast.c +1 -6
index 6c92eef..1b5e761 100644
@@ -281,7 +281,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
 {
 	struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
 	struct unicast_packet *unicast_packet;
-	struct orig_node *orig_node;
+	struct orig_node *orig_node = NULL;
 	struct batman_if *batman_if;
 	struct neigh_node *router;
 	int data_len = skb->len;
@@ -292,11 +292,6 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
 	/* get routing information */
 	if (is_multicast_ether_addr(ethhdr->h_dest))
 		orig_node = (struct orig_node *)gw_get_selected(bat_priv);
-	else
-		orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
-							   compare_orig,
-							   choose_orig,
-							   ethhdr->h_dest));
 
 	/* check for hna host */
 	if (!orig_node)
Signature · 1 line
1.7.2.3
maintainer
#6 lore raw
In reply to Sven Eckelmann

From: Sven Eckelmann <[email protected]>
Date: Sat, 12 Feb 2011 00:21:39 +0100

Quoted 9 lines

Hi,

I would like propose following changes for net-next-2.6.git. Two of them are minor code style changes and the other two change minor issues in the routing/fragmentation code.

thanks,
Sven

Quoted 6 lines

The following changes since commit 091b948306d2628320e77977eb7ae4a757b12180:

batman-adv: Merge README of v2011.0.0 release (2011-01-31 14:57:13 +0100)

are available in the git repository at:
git://git.open-mesh.org/ecsv/linux-merge.git batman-adv/next

Pulled, thanks Sven.