Hi,
here are patches targetted for 2.6.36. They are made on top of patches you have already received in 1275852501-28523-1-git-send-email-sven.eckelmann@gmx.de :
* Staging: batman-adv: remove redundant struct declaration * Staging: batman-adv: Move device for icmp injection to debugfs * Staging: batman-adv: Move tables from sysfs to debugfs * Staging: batman-adv: convert all sysfs files to single value files * Staging: batman-adv: Adding netfilter-bridge hooks * Staging: batman-adv: Add information about batman-adv sysfs entries * Staging: batman-adv: remove superfluous hint to "translation table" * Staging: batman-adv: convert vis_interval into define * Staging: batman-adv: Convert MAC_FMT to %pM
They also depend on patches not yet applied on 2.6.35, but sent to you:
* Staging: batman-adv: return -EFAULT on copy_to_user errors * Staging: batman-adv: fix function prototype
thanks, Sven
drivers/staging/batman-adv/CHANGELOG | 12 + drivers/staging/batman-adv/README | 2 +- drivers/staging/batman-adv/aggregation.c | 4 +- drivers/staging/batman-adv/bat_debugfs.c | 2 + drivers/staging/batman-adv/bat_sysfs.c | 54 ++++- drivers/staging/batman-adv/bitarray.c | 10 +- drivers/staging/batman-adv/bitarray.h | 9 +- drivers/staging/batman-adv/hard-interface.c | 4 +- drivers/staging/batman-adv/hash.c | 2 +- drivers/staging/batman-adv/hash.h | 6 - drivers/staging/batman-adv/icmp_socket.c | 45 ++-- drivers/staging/batman-adv/icmp_socket.h | 3 +- drivers/staging/batman-adv/main.h | 9 +- drivers/staging/batman-adv/originator.c | 40 ++-- drivers/staging/batman-adv/originator.h | 2 - drivers/staging/batman-adv/packet.h | 27 ++- drivers/staging/batman-adv/routing.c | 324 ++++++++++++++++++++---- drivers/staging/batman-adv/routing.h | 8 +- drivers/staging/batman-adv/send.c | 23 ++- drivers/staging/batman-adv/send.h | 2 - drivers/staging/batman-adv/soft-interface.c | 159 ++++++------ drivers/staging/batman-adv/soft-interface.h | 6 - drivers/staging/batman-adv/translation-table.c | 9 +- drivers/staging/batman-adv/translation-table.h | 3 - drivers/staging/batman-adv/types.h | 20 ++- drivers/staging/batman-adv/vis.c | 9 +- drivers/staging/batman-adv/vis.h | 3 - 27 files changed, 562 insertions(+), 235 deletions(-)
Daniel Seither (1): Staging: batman-adv: record route for ICMP messages
Linus Lüssing (1): Staging: batman-adv: permit setting ogm interval to JITTER*2
Simon Wunderlich (4): Staging: batman-adv: Add release information for version 2010.0.0 Staging: batman-adv: 32bit sequence number and TTL for broadcasts Staging: batman-adv: Add bonding functionality Staging: batman-adv: bonding and interface alternating
Sven Eckelmann (2): Staging: batman-adv: Mark locally used symbols as static Staging: batman-adv: Ignore debugfs on kernels without debugfs support
Functions and variables which are used only inside one object file can be declared as static. This helped to find unused functions/variables
* mainIfAddr_default * main_if_was_up
and functions with declarations but missing definitions
* hash_debug * orig_find * send_own_packet_work
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- drivers/staging/batman-adv/bitarray.c | 2 +- drivers/staging/batman-adv/bitarray.h | 3 - drivers/staging/batman-adv/hash.c | 2 +- drivers/staging/batman-adv/hash.h | 6 -- drivers/staging/batman-adv/originator.c | 32 ++++---- drivers/staging/batman-adv/originator.h | 2 - drivers/staging/batman-adv/routing.c | 2 +- drivers/staging/batman-adv/routing.h | 2 - drivers/staging/batman-adv/send.c | 4 +- drivers/staging/batman-adv/send.h | 2 - drivers/staging/batman-adv/soft-interface.c | 104 +++++++++++------------- drivers/staging/batman-adv/soft-interface.h | 6 -- drivers/staging/batman-adv/translation-table.c | 9 ++- drivers/staging/batman-adv/translation-table.h | 3 - drivers/staging/batman-adv/vis.c | 4 +- drivers/staging/batman-adv/vis.h | 3 - 16 files changed, 79 insertions(+), 107 deletions(-)
diff --git a/drivers/staging/batman-adv/bitarray.c b/drivers/staging/batman-adv/bitarray.c index 2fef6e3..cfca033 100644 --- a/drivers/staging/batman-adv/bitarray.c +++ b/drivers/staging/batman-adv/bitarray.c @@ -63,7 +63,7 @@ void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n) }
/* shift the packet array by n places. */ -void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n) +static void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n) { int32_t word_offset, word_num; int32_t i; diff --git a/drivers/staging/batman-adv/bitarray.h b/drivers/staging/batman-adv/bitarray.h index 76ad24c..4dd1e7c 100644 --- a/drivers/staging/batman-adv/bitarray.h +++ b/drivers/staging/batman-adv/bitarray.h @@ -32,9 +32,6 @@ uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint16_t last_seqno, /* turn corresponding bit on, so we can remember that we got the packet */ void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n);
-/* shift the packet array by n places. */ -void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n); -
/* receive and process one packet, returns 1 if received seq_num is considered * new, 0 if old */ diff --git a/drivers/staging/batman-adv/hash.c b/drivers/staging/batman-adv/hash.c index d4a4adc..1286f8f 100644 --- a/drivers/staging/batman-adv/hash.c +++ b/drivers/staging/batman-adv/hash.c @@ -23,7 +23,7 @@ #include "hash.h"
/* clears the hash */ -void hash_init(struct hashtable_t *hash) +static void hash_init(struct hashtable_t *hash) { int i;
diff --git a/drivers/staging/batman-adv/hash.h b/drivers/staging/batman-adv/hash.h index ea6d21e..0505595 100644 --- a/drivers/staging/batman-adv/hash.h +++ b/drivers/staging/batman-adv/hash.h @@ -56,9 +56,6 @@ struct hashtable_t { * argument and the size the second */ };
-/* clears the hash */ -void hash_init(struct hashtable_t *hash); - /* allocates and clears the hash */ struct hashtable_t *hash_new(int size, hashdata_compare_cb compare, hashdata_choose_cb choose); @@ -98,7 +95,4 @@ struct hashtable_t *hash_resize(struct hashtable_t *hash, int size); * the returned iterator to access the elements until hash_it_t returns NULL. */ struct hash_it_t *hash_iterate(struct hashtable_t *hash, struct hash_it_t *iter_in); - -/* print the hash table for debugging */ -void hash_debug(struct hashtable_t *hash); #endif diff --git a/drivers/staging/batman-adv/originator.c b/drivers/staging/batman-adv/originator.c index c159707..1f6cbe8 100644 --- a/drivers/staging/batman-adv/originator.c +++ b/drivers/staging/batman-adv/originator.c @@ -56,21 +56,6 @@ err: return 0; }
-void originator_free(void) -{ - unsigned long flags; - - if (!orig_hash) - return; - - cancel_delayed_work_sync(&purge_orig_wq); - - spin_lock_irqsave(&orig_hash_lock, flags); - hash_delete(orig_hash, free_orig_node); - orig_hash = NULL; - spin_unlock_irqrestore(&orig_hash_lock, flags); -} - struct neigh_node * create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node, uint8_t *neigh, struct batman_if *if_incoming) @@ -93,7 +78,7 @@ create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node, return neigh_node; }
-void free_orig_node(void *data) +static void free_orig_node(void *data) { struct list_head *list_pos, *list_pos_tmp; struct neigh_node *neigh_node; @@ -114,6 +99,21 @@ void free_orig_node(void *data) kfree(orig_node); }
+void originator_free(void) +{ + unsigned long flags; + + if (!orig_hash) + return; + + cancel_delayed_work_sync(&purge_orig_wq); + + spin_lock_irqsave(&orig_hash_lock, flags); + hash_delete(orig_hash, free_orig_node); + orig_hash = NULL; + spin_unlock_irqrestore(&orig_hash_lock, flags); +} + /* this function finds or creates an originator entry for the given * address if it does not exits */ struct orig_node *get_orig_node(uint8_t *addr) diff --git a/drivers/staging/batman-adv/originator.h b/drivers/staging/batman-adv/originator.h index e91e8a1..6632538 100644 --- a/drivers/staging/batman-adv/originator.h +++ b/drivers/staging/batman-adv/originator.h @@ -20,10 +20,8 @@ */
int originator_init(void); -void free_orig_node(void *data); void originator_free(void); void purge_orig(struct work_struct *work); -struct orig_node *orig_find(char *mac); struct orig_node *get_orig_node(uint8_t *addr); struct neigh_node * create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node, diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index d4bdca9..480c645 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c @@ -33,7 +33,7 @@ #include "vis.h" #include "aggregation.h"
-DECLARE_WAIT_QUEUE_HEAD(thread_wait); +static DECLARE_WAIT_QUEUE_HEAD(thread_wait);
void slide_own_bcast_window(struct batman_if *batman_if) { diff --git a/drivers/staging/batman-adv/routing.h b/drivers/staging/batman-adv/routing.h index 8288dec..c6850d2 100644 --- a/drivers/staging/batman-adv/routing.h +++ b/drivers/staging/batman-adv/routing.h @@ -21,8 +21,6 @@
#include "types.h"
-extern wait_queue_head_t thread_wait; - void slide_own_bcast_window(struct batman_if *batman_if); void receive_bat_packet(struct ethhdr *ethhdr, struct batman_packet *batman_packet, diff --git a/drivers/staging/batman-adv/send.c b/drivers/staging/batman-adv/send.c index 7365f6d..e8f0e2a 100644 --- a/drivers/staging/batman-adv/send.c +++ b/drivers/staging/batman-adv/send.c @@ -31,6 +31,8 @@
#include <linux/netfilter_bridge.h>
+static void send_outstanding_bcast_packet(struct work_struct *work); + /* apply hop penalty for a normal link */ static uint8_t hop_penalty(const uint8_t tq) { @@ -431,7 +433,7 @@ out: return NETDEV_TX_BUSY; }
-void send_outstanding_bcast_packet(struct work_struct *work) +static void send_outstanding_bcast_packet(struct work_struct *work) { struct batman_if *batman_if; struct delayed_work *delayed_work = diff --git a/drivers/staging/batman-adv/send.h b/drivers/staging/batman-adv/send.h index feaa2fc..0a0990d 100644 --- a/drivers/staging/batman-adv/send.h +++ b/drivers/staging/batman-adv/send.h @@ -21,7 +21,6 @@
#include "types.h"
-void send_own_packet_work(struct work_struct *work); int send_skb_packet(struct sk_buff *skb, struct batman_if *batman_if, uint8_t *dst_addr); @@ -34,6 +33,5 @@ void schedule_forward_packet(struct orig_node *orig_node, uint8_t directlink, int hna_buff_len, struct batman_if *if_outgoing); int add_bcast_packet_to_list(struct sk_buff *skb); -void send_outstanding_bcast_packet(struct work_struct *work); void send_outstanding_bat_packet(struct work_struct *work); void purge_outstanding_packets(struct batman_if *batman_if); diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c index 51c40b7..c483693 100644 --- a/drivers/staging/batman-adv/soft-interface.c +++ b/drivers/staging/batman-adv/soft-interface.c @@ -36,7 +36,6 @@ static int32_t skb_packets; static int32_t skb_bad_packets;
unsigned char mainIfAddr[ETH_ALEN]; -static unsigned char mainIfAddr_default[ETH_ALEN]; static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); static void bat_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info); @@ -61,11 +60,6 @@ void set_main_if_addr(uint8_t *addr) memcpy(mainIfAddr, addr, ETH_ALEN); }
-int main_if_was_up(void) -{ - return (memcmp(mainIfAddr, mainIfAddr_default, ETH_ALEN) != 0 ? 1 : 0); -} - int my_skb_push(struct sk_buff *skb, unsigned int len) { int result = 0; @@ -83,69 +77,25 @@ int my_skb_push(struct sk_buff *skb, unsigned int len) return 0; }
-#ifdef HAVE_NET_DEVICE_OPS -static const struct net_device_ops bat_netdev_ops = { - .ndo_open = interface_open, - .ndo_stop = interface_release, - .ndo_get_stats = interface_stats, - .ndo_set_mac_address = interface_set_mac_addr, - .ndo_change_mtu = interface_change_mtu, - .ndo_start_xmit = interface_tx, - .ndo_validate_addr = eth_validate_addr -}; -#endif - -void interface_setup(struct net_device *dev) -{ - struct bat_priv *priv = netdev_priv(dev); - char dev_addr[ETH_ALEN]; - - ether_setup(dev); - -#ifdef HAVE_NET_DEVICE_OPS - dev->netdev_ops = &bat_netdev_ops; -#else - dev->open = interface_open; - dev->stop = interface_release; - dev->get_stats = interface_stats; - dev->set_mac_address = interface_set_mac_addr; - dev->change_mtu = interface_change_mtu; - dev->hard_start_xmit = interface_tx; -#endif - dev->destructor = free_netdev; - - dev->mtu = hardif_min_mtu(); - dev->hard_header_len = BAT_HEADER_LEN; /* reserve more space in the - * skbuff for our header */ - - /* generate random address */ - random_ether_addr(dev_addr); - memcpy(dev->dev_addr, dev_addr, ETH_ALEN); - - SET_ETHTOOL_OPS(dev, &bat_ethtool_ops); - - memset(priv, 0, sizeof(struct bat_priv)); -} - -int interface_open(struct net_device *dev) +static int interface_open(struct net_device *dev) { netif_start_queue(dev); return 0; }
-int interface_release(struct net_device *dev) +static int interface_release(struct net_device *dev) { netif_stop_queue(dev); return 0; }
-struct net_device_stats *interface_stats(struct net_device *dev) +static struct net_device_stats *interface_stats(struct net_device *dev) { struct bat_priv *priv = netdev_priv(dev); return &priv->stats; }
-int interface_set_mac_addr(struct net_device *dev, void *p) +static int interface_set_mac_addr(struct net_device *dev, void *p) { struct sockaddr *addr = p;
@@ -163,7 +113,7 @@ int interface_set_mac_addr(struct net_device *dev, void *p) return 0; }
-int interface_change_mtu(struct net_device *dev, int new_mtu) +static int interface_change_mtu(struct net_device *dev, int new_mtu) { /* check ranges */ if ((new_mtu < 68) || (new_mtu > hardif_min_mtu())) @@ -315,6 +265,50 @@ void interface_rx(struct sk_buff *skb, int hdr_size) netif_rx(skb); }
+#ifdef HAVE_NET_DEVICE_OPS +static const struct net_device_ops bat_netdev_ops = { + .ndo_open = interface_open, + .ndo_stop = interface_release, + .ndo_get_stats = interface_stats, + .ndo_set_mac_address = interface_set_mac_addr, + .ndo_change_mtu = interface_change_mtu, + .ndo_start_xmit = interface_tx, + .ndo_validate_addr = eth_validate_addr +}; +#endif + +void interface_setup(struct net_device *dev) +{ + struct bat_priv *priv = netdev_priv(dev); + char dev_addr[ETH_ALEN]; + + ether_setup(dev); + +#ifdef HAVE_NET_DEVICE_OPS + dev->netdev_ops = &bat_netdev_ops; +#else + dev->open = interface_open; + dev->stop = interface_release; + dev->get_stats = interface_stats; + dev->set_mac_address = interface_set_mac_addr; + dev->change_mtu = interface_change_mtu; + dev->hard_start_xmit = interface_tx; +#endif + dev->destructor = free_netdev; + + dev->mtu = hardif_min_mtu(); + dev->hard_header_len = BAT_HEADER_LEN; /* reserve more space in the + * skbuff for our header */ + + /* generate random address */ + random_ether_addr(dev_addr); + memcpy(dev->dev_addr, dev_addr, ETH_ALEN); + + SET_ETHTOOL_OPS(dev, &bat_ethtool_ops); + + memset(priv, 0, sizeof(struct bat_priv)); +} + /* ethtool */ static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { diff --git a/drivers/staging/batman-adv/soft-interface.h b/drivers/staging/batman-adv/soft-interface.h index e7f59af..3852c57 100644 --- a/drivers/staging/batman-adv/soft-interface.h +++ b/drivers/staging/batman-adv/soft-interface.h @@ -20,13 +20,7 @@ */
void set_main_if_addr(uint8_t *addr); -int main_if_was_up(void); void interface_setup(struct net_device *dev); -int interface_open(struct net_device *dev); -int interface_release(struct net_device *dev); -struct net_device_stats *interface_stats(struct net_device *dev); -int interface_set_mac_addr(struct net_device *dev, void *addr); -int interface_change_mtu(struct net_device *dev, int new_mtu); int interface_tx(struct sk_buff *skb, struct net_device *dev); void interface_rx(struct sk_buff *skb, int hdr_size); int my_skb_push(struct sk_buff *skb, unsigned int len); diff --git a/drivers/staging/batman-adv/translation-table.c b/drivers/staging/batman-adv/translation-table.c index d9233b0..9fd32a9 100644 --- a/drivers/staging/batman-adv/translation-table.c +++ b/drivers/staging/batman-adv/translation-table.c @@ -32,7 +32,10 @@ atomic_t hna_local_changed; DEFINE_SPINLOCK(hna_local_hash_lock); static DEFINE_SPINLOCK(hna_global_hash_lock);
+static void hna_local_purge(struct work_struct *work); static DECLARE_DELAYED_WORK(hna_local_purge_wq, hna_local_purge); +static void _hna_global_del_orig(struct hna_global_entry *hna_global_entry, + char *message);
static void hna_local_start_timer(void) { @@ -242,7 +245,7 @@ void hna_local_remove(uint8_t *addr, char *message) spin_unlock_irqrestore(&hna_local_hash_lock, flags); }
-void hna_local_purge(struct work_struct *work) +static void hna_local_purge(struct work_struct *work) { struct hna_local_entry *hna_local_entry; HASHIT(hashit); @@ -423,8 +426,8 @@ int hna_global_seq_print_text(struct seq_file *seq, void *offset) return 0; }
-void _hna_global_del_orig(struct hna_global_entry *hna_global_entry, - char *message) +static void _hna_global_del_orig(struct hna_global_entry *hna_global_entry, + char *message) { bat_dbg(DBG_ROUTES, "Deleting global hna entry %pM (via %pM): %s\n", hna_global_entry->addr, hna_global_entry->orig_node->orig, diff --git a/drivers/staging/batman-adv/translation-table.h b/drivers/staging/batman-adv/translation-table.h index 8b3429e..232208f 100644 --- a/drivers/staging/batman-adv/translation-table.h +++ b/drivers/staging/batman-adv/translation-table.h @@ -26,14 +26,11 @@ void hna_local_add(uint8_t *addr); void hna_local_remove(uint8_t *addr, char *message); int hna_local_fill_buffer(unsigned char *buff, int buff_len); int hna_local_seq_print_text(struct seq_file *seq, void *offset); -void hna_local_purge(struct work_struct *work); void hna_local_free(void); int hna_global_init(void); void hna_global_add_orig(struct orig_node *orig_node, unsigned char *hna_buff, int hna_buff_len); int hna_global_seq_print_text(struct seq_file *seq, void *offset); -void _hna_global_del_orig(struct hna_global_entry *hna_global_entry, - char *orig_str); void hna_global_del_orig(struct orig_node *orig_node, char *message); void hna_global_free(void); struct orig_node *transtable_search(uint8_t *addr); diff --git a/drivers/staging/batman-adv/vis.c b/drivers/staging/batman-adv/vis.c index c73774b..7bd553a 100644 --- a/drivers/staging/batman-adv/vis.c +++ b/drivers/staging/batman-adv/vis.c @@ -43,8 +43,8 @@ _dummy > smallest_signed_int(_dummy); }) #define seq_after(x, y) seq_before(y, x)
-struct hashtable_t *vis_hash; -DEFINE_SPINLOCK(vis_hash_lock); +static struct hashtable_t *vis_hash; +static DEFINE_SPINLOCK(vis_hash_lock); static DEFINE_SPINLOCK(recv_list_lock); static struct vis_info *my_vis_info; static struct list_head send_list; /* always locked with vis_hash_lock */ diff --git a/drivers/staging/batman-adv/vis.h b/drivers/staging/batman-adv/vis.h index 5dd6521..1cfadce 100644 --- a/drivers/staging/batman-adv/vis.h +++ b/drivers/staging/batman-adv/vis.h @@ -44,9 +44,6 @@ struct recvlist_node { uint8_t mac[ETH_ALEN]; };
-extern struct hashtable_t *vis_hash; -extern spinlock_t vis_hash_lock; - int vis_seq_print_text(struct seq_file *seq, void *offset); void receive_server_sync_packet(struct bat_priv *bat_priv, struct vis_packet *vis_packet,
All code for debugfs is ignored when the creation of the batman-adv root directory in debugfs fails. It must also be ignored when the debugfs_create_dir tells us that debugfs is not implemented to prevent possible crashes in the future.
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- drivers/staging/batman-adv/bat_debugfs.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/batman-adv/bat_debugfs.c b/drivers/staging/batman-adv/bat_debugfs.c index a8fe1c9..fafca9f 100644 --- a/drivers/staging/batman-adv/bat_debugfs.c +++ b/drivers/staging/batman-adv/bat_debugfs.c @@ -88,6 +88,8 @@ static struct bat_debuginfo *mesh_debuginfos[] = { void debugfs_init(void) { bat_debugfs = debugfs_create_dir(DEBUGFS_BAT_SUBDIR, NULL); + if (bat_debugfs == ERR_PTR(-ENODEV)) + bat_debugfs = NULL; }
void debugfs_destroy(void)
From: Linus Lüssing linus.luessing@web.de
When trying to set the originator interval to 40ms, we are asked to set it to a minimum value of 40ms. This patch permits setting an originator interval of JITTER*2 (40ms by default) now.
Signed-off-by: Linus Lüssing linus.luessing@web.de Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- drivers/staging/batman-adv/bat_sysfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/batman-adv/bat_sysfs.c b/drivers/staging/batman-adv/bat_sysfs.c index b961817..b8ccb75 100644 --- a/drivers/staging/batman-adv/bat_sysfs.c +++ b/drivers/staging/batman-adv/bat_sysfs.c @@ -163,7 +163,7 @@ static ssize_t store_orig_interval(struct kobject *kobj, struct attribute *attr, return -EINVAL; }
- if (orig_interval_tmp <= JITTER * 2) { + if (orig_interval_tmp < JITTER * 2) { printk(KERN_INFO "batman-adv:New originator interval too small: %li (min: %i)\n", orig_interval_tmp, JITTER * 2); return -EINVAL;
From: Simon Wunderlich siwu@hrz.tu-chemnitz.de
Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- drivers/staging/batman-adv/CHANGELOG | 12 ++++++++++++ drivers/staging/batman-adv/README | 2 +- drivers/staging/batman-adv/main.h | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/batman-adv/CHANGELOG b/drivers/staging/batman-adv/CHANGELOG index c8f9d9e..86450b4 100644 --- a/drivers/staging/batman-adv/CHANGELOG +++ b/drivers/staging/batman-adv/CHANGELOG @@ -1,3 +1,15 @@ +batman-adv 2010.0.0: + +* support latest kernels (2.6.21 - 2.6.35) +* further code refactoring and cleaning for coding style +* move from procfs based configuration to sysfs +* reorganized sequence number handling +* limit queue lengths for batman and broadcast packets +* many bugs (endless loop and rogue packets on shutdown, wrong tcpdump output, + missing frees in error situations, sleeps in atomic contexts) squashed + + -- Fri, 18 Jun 2010 21:34:26 +0200 + batman-adv 0.2.1:
* support latest kernels (2.6.20 - 2.6.33) diff --git a/drivers/staging/batman-adv/README b/drivers/staging/batman-adv/README index 14244a2..7192b7f 100644 --- a/drivers/staging/batman-adv/README +++ b/drivers/staging/batman-adv/README @@ -1,4 +1,4 @@ -[state: 03-05-2010] +[state: 12-06-2010]
BATMAN-ADV ---------- diff --git a/drivers/staging/batman-adv/main.h b/drivers/staging/batman-adv/main.h index 7cb0b18..f70d99a 100644 --- a/drivers/staging/batman-adv/main.h +++ b/drivers/staging/batman-adv/main.h @@ -27,7 +27,7 @@ #define DRIVER_DESC "B.A.T.M.A.N. advanced" #define DRIVER_DEVICE "batman-adv"
-#define SOURCE_VERSION "0.2.2-beta" +#define SOURCE_VERSION "2010.0.0"
/* B.A.T.M.A.N. parameters */
From: Simon Wunderlich siwu@hrz.tu-chemnitz.de
This patch changes the sequence number range from 8 or 16 bit to 32 bit. This should avoid problems with the sequence number sliding window algorithm which we had seen in the past for broadcast floods or malicious packet injections. We can not assure 100% security with this patch, but it is quite an improvement over the old 16 bit sequence numbers:
* expected window size can be increased (4096 -> 65536) * 64k packets in the right order would now be needed to cause a loop, which seems practically impossible.
Furthermore, a TTL field has been added to the broadcast packet type, just to make sure.
These changes required to increase the compatibility level once again.
Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de [sven.eckelmann@gmx.de: Change atomic64_* back to atomic_*, Rework on top of current version] Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- drivers/staging/batman-adv/aggregation.c | 4 ++-- drivers/staging/batman-adv/bitarray.c | 8 ++++---- drivers/staging/batman-adv/bitarray.h | 6 +++--- drivers/staging/batman-adv/main.h | 2 +- drivers/staging/batman-adv/packet.h | 9 +++++---- drivers/staging/batman-adv/routing.c | 17 ++++++++++------- drivers/staging/batman-adv/send.c | 15 ++++++++++----- drivers/staging/batman-adv/soft-interface.c | 5 +++-- drivers/staging/batman-adv/types.h | 6 +++--- drivers/staging/batman-adv/vis.c | 5 +++-- 10 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/batman-adv/aggregation.c b/drivers/staging/batman-adv/aggregation.c index ce8b8a6..3a5c349 100644 --- a/drivers/staging/batman-adv/aggregation.c +++ b/drivers/staging/batman-adv/aggregation.c @@ -252,9 +252,9 @@ void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, while (aggregated_packet(buff_pos, packet_len, batman_packet->num_hna)) {
- /* network to host order for our 16bit seqno, and the + /* network to host order for our 32bit seqno, and the orig_interval. */ - batman_packet->seqno = ntohs(batman_packet->seqno); + batman_packet->seqno = ntohl(batman_packet->seqno);
hna_buff = packet_buff + buff_pos + BAT_PACKET_LEN; receive_bat_packet(ethhdr, batman_packet, diff --git a/drivers/staging/batman-adv/bitarray.c b/drivers/staging/batman-adv/bitarray.c index cfca033..c10fe03 100644 --- a/drivers/staging/batman-adv/bitarray.c +++ b/drivers/staging/batman-adv/bitarray.c @@ -24,10 +24,10 @@
/* returns true if the corresponding bit in the given seq_bits indicates true * and curr_seqno is within range of last_seqno */ -uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint16_t last_seqno, - uint16_t curr_seqno) +uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint32_t last_seqno, + uint32_t curr_seqno) { - int16_t diff, word_offset, word_num; + int32_t diff, word_offset, word_num;
diff = last_seqno - curr_seqno; if (diff < 0 || diff >= TQ_LOCAL_WINDOW_SIZE) { @@ -125,7 +125,7 @@ static void bit_reset_window(TYPE_OF_WORD *seq_bits) * 1 if the window was moved (either new or very old) * 0 if the window was not moved/shifted. */ -char bit_get_packet(TYPE_OF_WORD *seq_bits, int16_t seq_num_diff, +char bit_get_packet(TYPE_OF_WORD *seq_bits, int32_t seq_num_diff, int8_t set_mark) { /* sequence number is slightly older. We already got a sequence number diff --git a/drivers/staging/batman-adv/bitarray.h b/drivers/staging/batman-adv/bitarray.h index 4dd1e7c..dad13bf 100644 --- a/drivers/staging/batman-adv/bitarray.h +++ b/drivers/staging/batman-adv/bitarray.h @@ -26,8 +26,8 @@
/* returns true if the corresponding bit in the given seq_bits indicates true * and curr_seqno is within range of last_seqno */ -uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint16_t last_seqno, - uint16_t curr_seqno); +uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint32_t last_seqno, + uint32_t curr_seqno);
/* turn corresponding bit on, so we can remember that we got the packet */ void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n); @@ -35,7 +35,7 @@ void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n);
/* receive and process one packet, returns 1 if received seq_num is considered * new, 0 if old */ -char bit_get_packet(TYPE_OF_WORD *seq_bits, int16_t seq_num_diff, +char bit_get_packet(TYPE_OF_WORD *seq_bits, int32_t seq_num_diff, int8_t set_mark);
/* count the hamming weight, how many good packets did we receive? */ diff --git a/drivers/staging/batman-adv/main.h b/drivers/staging/batman-adv/main.h index f70d99a..145ac51 100644 --- a/drivers/staging/batman-adv/main.h +++ b/drivers/staging/batman-adv/main.h @@ -65,7 +65,7 @@ #define MAX_AGGREGATION_MS 100
#define RESET_PROTECTION_MS 30000 -#define EXPECTED_SEQNO_RANGE 4096 +#define EXPECTED_SEQNO_RANGE 65536 /* don't reset again within 30 seconds */
#define MODULE_INACTIVE 0 diff --git a/drivers/staging/batman-adv/packet.h b/drivers/staging/batman-adv/packet.h index 152f57b..f0387ba 100644 --- a/drivers/staging/batman-adv/packet.h +++ b/drivers/staging/batman-adv/packet.h @@ -28,7 +28,7 @@ #define BAT_VIS 0x05
/* this file is included by batctl which needs these defines */ -#define COMPAT_VERSION 8 +#define COMPAT_VERSION 11 #define DIRECTLINK 0x40 #define VIS_SERVER 0x20
@@ -48,7 +48,7 @@ struct batman_packet { uint8_t version; /* batman version field */ uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */ uint8_t tq; - uint16_t seqno; + uint32_t seqno; uint8_t orig[6]; uint8_t prev_sender[6]; uint8_t ttl; @@ -79,15 +79,16 @@ struct bcast_packet { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t orig[6]; - uint16_t seqno; + uint8_t ttl; + uint32_t seqno; } __attribute__((packed));
struct vis_packet { uint8_t packet_type; uint8_t version; /* batman version field */ uint8_t vis_type; /* which type of vis-participant sent this? */ - uint8_t seqno; /* sequence number */ uint8_t entries; /* number of entries behind this struct */ + uint32_t seqno; /* sequence number */ uint8_t ttl; /* TTL */ uint8_t vis_orig[6]; /* originator that informs about its * neighbors */ diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index 480c645..9dbfabe 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c @@ -318,7 +318,7 @@ update_hna: * 0 if the packet is to be accepted * 1 if the packet is to be ignored. */ -static int window_protected(int16_t seq_num_diff, +static int window_protected(int32_t seq_num_diff, unsigned long *last_reset) { if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) @@ -352,7 +352,7 @@ static char count_real_packets(struct ethhdr *ethhdr, struct orig_node *orig_node; struct neigh_node *tmp_neigh_node; char is_duplicate = 0; - int16_t seq_diff; + int32_t seq_diff; int need_update = 0; int set_mark;
@@ -406,7 +406,7 @@ void receive_bat_packet(struct ethhdr *ethhdr, char is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0; char is_broadcast = 0, is_bidirectional, is_single_hop_neigh; char is_duplicate; - unsigned short if_incoming_seqno; + uint32_t if_incoming_seqno;
/* Silently drop when the batman packet is actually not a * correct packet. @@ -950,7 +950,7 @@ int recv_bcast_packet(struct sk_buff *skb) struct bcast_packet *bcast_packet; struct ethhdr *ethhdr; int hdr_size = sizeof(struct bcast_packet); - int16_t seq_diff; + int32_t seq_diff; unsigned long flags;
/* drop packet if it has not necessary minimum size */ @@ -977,6 +977,9 @@ int recv_bcast_packet(struct sk_buff *skb) if (is_my_mac(bcast_packet->orig)) return NET_RX_DROP;
+ if (bcast_packet->ttl < 2) + return NET_RX_DROP; + spin_lock_irqsave(&orig_hash_lock, flags); orig_node = ((struct orig_node *) hash_find(orig_hash, bcast_packet->orig)); @@ -989,12 +992,12 @@ int recv_bcast_packet(struct sk_buff *skb) /* check whether the packet is a duplicate */ if (get_bit_status(orig_node->bcast_bits, orig_node->last_bcast_seqno, - ntohs(bcast_packet->seqno))) { + ntohl(bcast_packet->seqno))) { spin_unlock_irqrestore(&orig_hash_lock, flags); return NET_RX_DROP; }
- seq_diff = ntohs(bcast_packet->seqno) - orig_node->last_bcast_seqno; + seq_diff = ntohl(bcast_packet->seqno) - orig_node->last_bcast_seqno;
/* check whether the packet is old and the host just restarted. */ if (window_protected(seq_diff, &orig_node->bcast_seqno_reset)) { @@ -1005,7 +1008,7 @@ int recv_bcast_packet(struct sk_buff *skb) /* mark broadcast in flood history, update window position * if required. */ if (bit_get_packet(orig_node->bcast_bits, seq_diff, 1)) - orig_node->last_bcast_seqno = ntohs(bcast_packet->seqno); + orig_node->last_bcast_seqno = ntohl(bcast_packet->seqno);
spin_unlock_irqrestore(&orig_hash_lock, flags); /* rebroadcast packet */ diff --git a/drivers/staging/batman-adv/send.c b/drivers/staging/batman-adv/send.c index e8f0e2a..f2653dd 100644 --- a/drivers/staging/batman-adv/send.c +++ b/drivers/staging/batman-adv/send.c @@ -159,7 +159,7 @@ static void send_packet_to_if(struct forw_packet *forw_packet, "%s %spacket (originator %pM, seqno %d, TQ %d, TTL %d," " IDF %s) on interface %s [%s]\n", fwd_str, (packet_num > 0 ? "aggregated " : ""), - batman_packet->orig, ntohs(batman_packet->seqno), + batman_packet->orig, ntohl(batman_packet->seqno), batman_packet->tq, batman_packet->ttl, (batman_packet->flags & DIRECTLINK ? "on" : "off"), @@ -204,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet) "%s packet (originator %pM, seqno %d, TTL %d) " "on interface %s [%s]\n", (forw_packet->own ? "Sending own" : "Forwarding"), - batman_packet->orig, ntohs(batman_packet->seqno), + batman_packet->orig, ntohl(batman_packet->seqno), batman_packet->ttl, forw_packet->if_incoming->dev, forw_packet->if_incoming->addr_str);
@@ -283,14 +283,14 @@ void schedule_own_packet(struct batman_if *batman_if) batman_packet = (struct batman_packet *)batman_if->packet_buff;
/* change sequence number to network order */ - batman_packet->seqno = htons((uint16_t)atomic_read(&batman_if->seqno)); + batman_packet->seqno = + htonl((uint32_t)atomic_read(&batman_if->seqno));
if (vis_server == VIS_TYPE_SERVER_SYNC) batman_packet->flags = VIS_SERVER; else batman_packet->flags &= ~VIS_SERVER;
- /* could be read by receive_bat_packet() */ atomic_inc(&batman_if->seqno);
slide_own_bcast_window(batman_if); @@ -347,7 +347,7 @@ void schedule_forward_packet(struct orig_node *orig_node, in_tq, tq_avg, batman_packet->tq, in_ttl - 1, batman_packet->ttl);
- batman_packet->seqno = htons(batman_packet->seqno); + batman_packet->seqno = htonl(batman_packet->seqno);
if (directlink) batman_packet->flags |= DIRECTLINK; @@ -399,6 +399,7 @@ static void _add_bcast_packet_to_list(struct forw_packet *forw_packet, int add_bcast_packet_to_list(struct sk_buff *skb) { struct forw_packet *forw_packet; + struct bcast_packet *bcast_packet;
if (!atomic_dec_not_zero(&bcast_queue_left)) { bat_dbg(DBG_BATMAN, "bcast packet queue full\n"); @@ -414,6 +415,10 @@ int add_bcast_packet_to_list(struct sk_buff *skb) if (!skb) goto packet_free;
+ /* as we have a copy now, it is safe to decrease the TTL */ + bcast_packet = (struct bcast_packet *)skb->data; + bcast_packet->ttl--; + skb_reset_mac_header(skb);
forw_packet->skb = skb; diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c index c483693..ce789a7 100644 --- a/drivers/staging/batman-adv/soft-interface.c +++ b/drivers/staging/batman-adv/soft-interface.c @@ -30,7 +30,7 @@ #include <linux/ethtool.h> #include <linux/etherdevice.h>
-static uint16_t bcast_seqno = 1; /* give own bcast messages seq numbers to avoid +static uint32_t bcast_seqno = 1; /* give own bcast messages seq numbers to avoid * broadcast storms */ static int32_t skb_packets; static int32_t skb_bad_packets; @@ -155,6 +155,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev)
bcast_packet = (struct bcast_packet *)skb->data; bcast_packet->version = COMPAT_VERSION; + bcast_packet->ttl = TTL;
/* batman packet type: broadcast */ bcast_packet->packet_type = BAT_BCAST; @@ -164,7 +165,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev) memcpy(bcast_packet->orig, mainIfAddr, ETH_ALEN);
/* set broadcast sequence number */ - bcast_packet->seqno = htons(bcast_seqno); + bcast_packet->seqno = htonl(bcast_seqno);
/* broadcast packet. on success, increase seqno. */ if (add_bcast_packet_to_list(skb) == NETDEV_TX_OK) diff --git a/drivers/staging/batman-adv/types.h b/drivers/staging/batman-adv/types.h index 751cd63..d0af489 100644 --- a/drivers/staging/batman-adv/types.h +++ b/drivers/staging/batman-adv/types.h @@ -72,11 +72,11 @@ struct orig_node { unsigned long batman_seqno_reset; uint8_t flags; unsigned char *hna_buff; - int16_t hna_buff_len; - uint16_t last_real_seqno; + int16_t hna_buff_len; + uint32_t last_real_seqno; uint8_t last_ttl; TYPE_OF_WORD bcast_bits[NUM_WORDS]; - uint16_t last_bcast_seqno; + uint32_t last_bcast_seqno; struct list_head neigh_list; };
diff --git a/drivers/staging/batman-adv/vis.c b/drivers/staging/batman-adv/vis.c index 7bd553a..d9ab981 100644 --- a/drivers/staging/batman-adv/vis.c +++ b/drivers/staging/batman-adv/vis.c @@ -357,7 +357,8 @@ static struct vis_info *add_packet(struct vis_packet *vis_packet, old_info = hash_find(vis_hash, &search_elem);
if (old_info != NULL) { - if (!seq_after(vis_packet->seqno, old_info->packet.seqno)) { + if (!seq_after(ntohl(vis_packet->seqno), + ntohl(old_info->packet.seqno))) { if (old_info->packet.seqno == vis_packet->seqno) { recv_list_add(&old_info->recv_list, vis_packet->sender_orig); @@ -525,7 +526,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv) spin_lock_irqsave(&orig_hash_lock, flags); memcpy(info->packet.target_orig, broadcastAddr, ETH_ALEN); info->packet.ttl = TTL; - info->packet.seqno++; + info->packet.seqno = htonl(ntohl(info->packet.seqno) + 1); info->packet.entries = 0;
if (info->packet.vis_type == VIS_TYPE_CLIENT_UPDATE) {
From: Simon Wunderlich siwu@hrz.tu-chemnitz.de
This patch introduces bonding functionality to batman-advanced, targeted for the 0.3 release. As we are able to route the payload traffic as we want, we may use multiple interfaces on multihomed hosts to transfer data to achieve higher bandwidth. This can be considered as "light Multi Path Routing" for single hop connections.
To detect which interfaces of a peer node belong to the same host, a new flag PRIMARIES_FIRST_HOP is introduced. This flag is set on the first hop of OGMs of the primary (first) interface, which is broadcasted on all interfaces. When receiving such an OGM, we can learn which interfaces belong to the same host (by assigning them to the primary originator).
Bonding works by sending packets in a round-robin fashion to the available interfaces of a neighbor host, if multiple interfaces are available. The neighbor interfaces should be almost equally good to reach.
To avoid interferences (i.e. sending on the same channel), only neighbor interfaces with different mac addresses and different outgoing interfaces are considered as candidates.
Bonding is deactivated by default, and can be activated by
echo 1 > /sys/class/net/bat0/mesh/bonding
for each individual node.
Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de [sven.eckelmann@gmx.de: Rework on top of current version] Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- drivers/staging/batman-adv/bat_sysfs.c | 52 ++++++ drivers/staging/batman-adv/hard-interface.c | 2 +- drivers/staging/batman-adv/main.h | 5 + drivers/staging/batman-adv/originator.c | 8 +- drivers/staging/batman-adv/packet.h | 1 + drivers/staging/batman-adv/routing.c | 242 +++++++++++++++++++++++--- drivers/staging/batman-adv/routing.h | 3 + drivers/staging/batman-adv/send.c | 4 +- drivers/staging/batman-adv/soft-interface.c | 60 ++++---- drivers/staging/batman-adv/types.h | 11 ++ 10 files changed, 327 insertions(+), 61 deletions(-)
diff --git a/drivers/staging/batman-adv/bat_sysfs.c b/drivers/staging/batman-adv/bat_sysfs.c index b8ccb75..4e9c71d 100644 --- a/drivers/staging/batman-adv/bat_sysfs.c +++ b/drivers/staging/batman-adv/bat_sysfs.c @@ -84,6 +84,55 @@ static ssize_t store_aggr_ogms(struct kobject *kobj, struct attribute *attr, return count; }
+static ssize_t show_bond(struct kobject *kobj, struct attribute *attr, + char *buff) +{ + struct device *dev = to_dev(kobj->parent); + struct bat_priv *bat_priv = netdev_priv(to_net_dev(dev)); + int bond_status = atomic_read(&bat_priv->bonding_enabled); + + return sprintf(buff, "%s\n", + bond_status == 0 ? "disabled" : "enabled"); +} + +static ssize_t store_bond(struct kobject *kobj, struct attribute *attr, + char *buff, size_t count) +{ + struct device *dev = to_dev(kobj->parent); + struct net_device *net_dev = to_net_dev(dev); + struct bat_priv *bat_priv = netdev_priv(net_dev); + int bonding_enabled_tmp = -1; + + if (((count == 2) && (buff[0] == '1')) || + (strncmp(buff, "enable", 6) == 0)) + bonding_enabled_tmp = 1; + + if (((count == 2) && (buff[0] == '0')) || + (strncmp(buff, "disable", 7) == 0)) + bonding_enabled_tmp = 0; + + if (bonding_enabled_tmp < 0) { + if (buff[count - 1] == '\n') + buff[count - 1] = '\0'; + + printk(KERN_ERR "batman-adv:Invalid parameter for 'bonding' setting on mesh %s received: %s\n", + net_dev->name, buff); + return -EINVAL; + } + + if (atomic_read(&bat_priv->bonding_enabled) == bonding_enabled_tmp) + return count; + + printk(KERN_INFO "batman-adv:Changing bonding from: %s to: %s on mesh: %s\n", + atomic_read(&bat_priv->bonding_enabled) == 1 ? + "enabled" : "disabled", + bonding_enabled_tmp == 1 ? "enabled" : "disabled", + net_dev->name); + + atomic_set(&bat_priv->bonding_enabled, (unsigned)bonding_enabled_tmp); + return count; +} + static ssize_t show_vis_mode(struct kobject *kobj, struct attribute *attr, char *buff) { @@ -182,12 +231,14 @@ static ssize_t store_orig_interval(struct kobject *kobj, struct attribute *attr,
static BAT_ATTR(aggregated_ogms, S_IRUGO | S_IWUSR, show_aggr_ogms, store_aggr_ogms); +static BAT_ATTR(bonding, S_IRUGO | S_IWUSR, show_bond, store_bond); static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); static BAT_ATTR(orig_interval, S_IRUGO | S_IWUSR, show_orig_interval, store_orig_interval);
static struct bat_attribute *mesh_attrs[] = { &bat_attr_aggregated_ogms, + &bat_attr_bonding, &bat_attr_vis_mode, &bat_attr_orig_interval, NULL, @@ -203,6 +254,7 @@ int sysfs_add_meshif(struct net_device *dev) /* FIXME: should be done in the general mesh setup routine as soon as we have it */ atomic_set(&bat_priv->aggregation_enabled, 1); + atomic_set(&bat_priv->bonding_enabled, 0); atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE); atomic_set(&bat_priv->orig_interval, 1000); bat_priv->primary_if = NULL; diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c index c7a1c31..028a7ea 100644 --- a/drivers/staging/batman-adv/hard-interface.c +++ b/drivers/staging/batman-adv/hard-interface.c @@ -109,7 +109,7 @@ static void set_primary_if(struct bat_priv *bat_priv, set_main_if_addr(batman_if->net_dev->dev_addr);
batman_packet = (struct batman_packet *)(batman_if->packet_buff); - batman_packet->flags = 0; + batman_packet->flags = PRIMARIES_FIRST_HOP; batman_packet->ttl = TTL;
/*** diff --git a/drivers/staging/batman-adv/main.h b/drivers/staging/batman-adv/main.h index 145ac51..fe5ee51 100644 --- a/drivers/staging/batman-adv/main.h +++ b/drivers/staging/batman-adv/main.h @@ -59,6 +59,11 @@
#define VIS_INTERVAL 5000 /* 5 seconds */
+/* how much worse secondary interfaces may be to + * to be considered as bonding candidates */ + +#define BONDING_TQ_THRESHOLD 50 + #define MAX_AGGREGATION_BYTES 512 /* should not be bigger than 512 bytes or * change the size of * forw_packet->direct_link_flags */ diff --git a/drivers/staging/batman-adv/originator.c b/drivers/staging/batman-adv/originator.c index 1f6cbe8..195c1ee 100644 --- a/drivers/staging/batman-adv/originator.c +++ b/drivers/staging/batman-adv/originator.c @@ -226,6 +226,8 @@ static bool purge_orig_neighbors(struct orig_node *orig_node,
static bool purge_orig_node(struct orig_node *orig_node) { + /* FIXME: each batman_if will be attached to a softif */ + struct bat_priv *bat_priv = netdev_priv(soft_device); struct neigh_node *best_neigh_node;
if (time_after(jiffies, @@ -237,10 +239,14 @@ static bool purge_orig_node(struct orig_node *orig_node) orig_node->orig, (orig_node->last_valid / HZ)); return true; } else { - if (purge_orig_neighbors(orig_node, &best_neigh_node)) + if (purge_orig_neighbors(orig_node, &best_neigh_node)) { update_routes(orig_node, best_neigh_node, orig_node->hna_buff, orig_node->hna_buff_len); + /* update bonding candidates, we could have lost + * some candidates. */ + update_bonding_candidates(bat_priv, orig_node); + } }
return false; diff --git a/drivers/staging/batman-adv/packet.h b/drivers/staging/batman-adv/packet.h index f0387ba..d0d35ea 100644 --- a/drivers/staging/batman-adv/packet.h +++ b/drivers/staging/batman-adv/packet.h @@ -31,6 +31,7 @@ #define COMPAT_VERSION 11 #define DIRECTLINK 0x40 #define VIS_SERVER 0x20 +#define PRIMARIES_FIRST_HOP 0x10
/* ICMP message types */ #define ECHO_REPLY 0 diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index 9dbfabe..6a2c2d1 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c @@ -395,11 +395,132 @@ static char count_real_packets(struct ethhdr *ethhdr, return is_duplicate; }
+/* copy primary address for bonding */ +static void mark_bonding_address(struct bat_priv *bat_priv, + struct orig_node *orig_node, + struct orig_node *orig_neigh_node, + struct batman_packet *batman_packet) + +{ + /* don't care if bonding is not enabled */ + if (!atomic_read(&bat_priv->bonding_enabled)) { + orig_node->bond.candidates = 0; + return; + } + + if (batman_packet->flags & PRIMARIES_FIRST_HOP) + memcpy(orig_neigh_node->primary_addr, + orig_node->orig, ETH_ALEN); + + return; +} + +/* mark possible bond.candidates in the neighbor list */ +void update_bonding_candidates(struct bat_priv *bat_priv, + struct orig_node *orig_node) +{ + int candidates; + int interference_candidate; + int best_tq; + struct neigh_node *tmp_neigh_node, *tmp_neigh_node2; + struct neigh_node *first_candidate, *last_candidate; + + /* don't care if bonding is not enabled */ + if (!atomic_read(&bat_priv->bonding_enabled)) { + orig_node->bond.candidates = 0; + return; + } + + /* update the candidates for this originator */ + if (!orig_node->router) { + orig_node->bond.candidates = 0; + return; + } + + best_tq = orig_node->router->tq_avg; + + /* update bond.candidates */ + + candidates = 0; + + /* mark other nodes which also received "PRIMARIES FIRST HOP" packets + * as "bonding partner" */ + + /* first, zero the list */ + list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { + tmp_neigh_node->next_bond_candidate = NULL; + } + + first_candidate = NULL; + last_candidate = NULL; + list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { + + /* only consider if it has the same primary address ... */ + if (memcmp(orig_node->orig, + tmp_neigh_node->orig_node->primary_addr, + ETH_ALEN) != 0) + continue; + + /* ... and is good enough to be considered */ + if (tmp_neigh_node->tq_avg < best_tq - BONDING_TQ_THRESHOLD) + continue; + + /* check if we have another candidate with the same + * mac address or interface. If we do, we won't + * select this candidate because of possible interference. */ + + interference_candidate = 0; + list_for_each_entry(tmp_neigh_node2, + &orig_node->neigh_list, list) { + + if (tmp_neigh_node2 == tmp_neigh_node) + continue; + + /* we only care if the other candidate is even + * considered as candidate. */ + if (tmp_neigh_node2->next_bond_candidate == NULL) + continue; + + + if ((tmp_neigh_node->if_incoming == + tmp_neigh_node2->if_incoming) + || (memcmp(tmp_neigh_node->addr, + tmp_neigh_node2->addr, ETH_ALEN) == 0)) { + + interference_candidate = 1; + break; + } + } + /* don't care further if it is an interference candidate */ + if (interference_candidate) + continue; + + if (first_candidate == NULL) { + first_candidate = tmp_neigh_node; + tmp_neigh_node->next_bond_candidate = first_candidate; + } else + tmp_neigh_node->next_bond_candidate = last_candidate; + + last_candidate = tmp_neigh_node; + + candidates++; + } + + if (candidates > 0) { + first_candidate->next_bond_candidate = last_candidate; + orig_node->bond.selected = first_candidate; + } + + orig_node->bond.candidates = candidates; +} + void receive_bat_packet(struct ethhdr *ethhdr, struct batman_packet *batman_packet, unsigned char *hna_buff, int hna_buff_len, struct batman_if *if_incoming) { + /* FIXME: each orig_node->batman_if will be attached to a softif */ + struct bat_priv *bat_priv = netdev_priv(soft_device); struct batman_if *batman_if; struct orig_node *orig_neigh_node, *orig_node; char has_directlink_flag; @@ -577,6 +698,10 @@ void receive_bat_packet(struct ethhdr *ethhdr, update_orig(orig_node, ethhdr, batman_packet, if_incoming, hna_buff, hna_buff_len, is_duplicate);
+ mark_bonding_address(bat_priv, orig_node, + orig_neigh_node, batman_packet); + update_bonding_candidates(bat_priv, orig_node); + /* is single hop (direct) neighbor */ if (is_single_hop_neigh) {
@@ -859,16 +984,75 @@ int recv_icmp_packet(struct sk_buff *skb) return ret; }
+/* find a suitable router for this originator, and use + * bonding if possible. */ +struct neigh_node *find_router(struct orig_node *orig_node) +{ + /* FIXME: each orig_node->batman_if will be attached to a softif */ + struct bat_priv *bat_priv = netdev_priv(soft_device); + struct orig_node *primary_orig_node; + struct orig_node *router_orig; + struct neigh_node *router; + static uint8_t zero_mac[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; + + if (!orig_node) + return NULL; + + if (!orig_node->router) + return NULL; + + /* don't care if bonding is not enabled */ + if (!atomic_read(&bat_priv->bonding_enabled)) + return orig_node->router; + + router_orig = orig_node->router->orig_node; + + /* if we have something in the primary_addr, we can search + * for a potential bonding candidate. */ + if (memcmp(router_orig->primary_addr, zero_mac, ETH_ALEN) == 0) + return orig_node->router; + + /* find the orig_node which has the primary interface. might + * even be the same as our router_orig in many cases */ + + if (memcmp(router_orig->primary_addr, + router_orig->orig, ETH_ALEN) == 0) { + primary_orig_node = router_orig; + } else { + primary_orig_node = hash_find(orig_hash, + router_orig->primary_addr); + if (!primary_orig_node) + return orig_node->router; + } + + /* with less than 2 candidates, we can't do any + * bonding and prefer the original router. */ + + if (primary_orig_node->bond.candidates < 2) + return orig_node->router; + + router = primary_orig_node->bond.selected; + + /* sanity check - this should never happen. */ + if (!router) + return orig_node->router; + + /* select the next bonding partner ... */ + primary_orig_node->bond.selected = router->next_bond_candidate; + + return router; +} + int recv_unicast_packet(struct sk_buff *skb) { struct unicast_packet *unicast_packet; struct orig_node *orig_node; + struct neigh_node *router; struct ethhdr *ethhdr; struct batman_if *batman_if; struct sk_buff *skb_old; uint8_t dstaddr[ETH_ALEN]; int hdr_size = sizeof(struct unicast_packet); - int ret; unsigned long flags;
/* drop packet if it has not necessary minimum size */ @@ -906,42 +1090,44 @@ int recv_unicast_packet(struct sk_buff *skb) return NET_RX_DROP; }
- ret = NET_RX_DROP; /* get routing information */ spin_lock_irqsave(&orig_hash_lock, flags); orig_node = ((struct orig_node *) hash_find(orig_hash, unicast_packet->dest));
- if ((orig_node != NULL) && - (orig_node->router != NULL)) { + router = find_router(orig_node);
- /* don't lock while sending the packets ... we therefore - * copy the required data before sending */ - batman_if = orig_node->router->if_incoming; - memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); + if (!router) { spin_unlock_irqrestore(&orig_hash_lock, flags); + return NET_RX_DROP; + }
- /* create a copy of the skb, if needed, to modify it. */ - if (!skb_clone_writable(skb, sizeof(struct unicast_packet))) { - skb_old = skb; - skb = skb_copy(skb, GFP_ATOMIC); - if (!skb) - return NET_RX_DROP; - unicast_packet = (struct unicast_packet *)skb->data; - ethhdr = (struct ethhdr *)skb_mac_header(skb); - kfree_skb(skb_old); - } - /* decrement ttl */ - unicast_packet->ttl--; - - /* route it */ - send_skb_packet(skb, batman_if, dstaddr); - ret = NET_RX_SUCCESS; - - } else - spin_unlock_irqrestore(&orig_hash_lock, flags); + /* don't lock while sending the packets ... we therefore + * copy the required data before sending */ + + batman_if = router->if_incoming; + memcpy(dstaddr, router->addr, ETH_ALEN); + + spin_unlock_irqrestore(&orig_hash_lock, flags); + + /* create a copy of the skb, if needed, to modify it. */ + if (!skb_clone_writable(skb, sizeof(struct unicast_packet))) { + skb_old = skb; + skb = skb_copy(skb, GFP_ATOMIC); + if (!skb) + return NET_RX_DROP; + unicast_packet = (struct unicast_packet *) skb->data; + ethhdr = (struct ethhdr *)skb_mac_header(skb); + kfree_skb(skb_old); + } + + /* decrement ttl */ + unicast_packet->ttl--; + + /* route it */ + send_skb_packet(skb, batman_if, dstaddr);
- return ret; + return NET_RX_SUCCESS; }
int recv_bcast_packet(struct sk_buff *skb) diff --git a/drivers/staging/batman-adv/routing.h b/drivers/staging/batman-adv/routing.h index c6850d2..0e33d22 100644 --- a/drivers/staging/batman-adv/routing.h +++ b/drivers/staging/batman-adv/routing.h @@ -35,3 +35,6 @@ int recv_bcast_packet(struct sk_buff *skb); int recv_vis_packet(struct sk_buff *skb); int recv_bat_packet(struct sk_buff *skb, struct batman_if *batman_if); +struct neigh_node *find_router(struct orig_node *orig_node); +void update_bonding_candidates(struct bat_priv *bat_priv, + struct orig_node *orig_node); diff --git a/drivers/staging/batman-adv/send.c b/drivers/staging/batman-adv/send.c index f2653dd..e61a62c 100644 --- a/drivers/staging/batman-adv/send.c +++ b/drivers/staging/batman-adv/send.c @@ -287,7 +287,7 @@ void schedule_own_packet(struct batman_if *batman_if) htonl((uint32_t)atomic_read(&batman_if->seqno));
if (vis_server == VIS_TYPE_SERVER_SYNC) - batman_packet->flags = VIS_SERVER; + batman_packet->flags |= VIS_SERVER; else batman_packet->flags &= ~VIS_SERVER;
@@ -349,6 +349,8 @@ void schedule_forward_packet(struct orig_node *orig_node,
batman_packet->seqno = htonl(batman_packet->seqno);
+ /* switch of primaries first hop flag when forwarding */ + batman_packet->flags &= ~PRIMARIES_FIRST_HOP; if (directlink) batman_packet->flags |= DIRECTLINK; else diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c index ce789a7..37fd565 100644 --- a/drivers/staging/batman-adv/soft-interface.c +++ b/drivers/staging/batman-adv/soft-interface.c @@ -22,6 +22,7 @@ #include "main.h" #include "soft-interface.h" #include "hard-interface.h" +#include "routing.h" #include "send.h" #include "translation-table.h" #include "types.h" @@ -129,6 +130,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev) struct unicast_packet *unicast_packet; struct bcast_packet *bcast_packet; struct orig_node *orig_node; + struct neigh_node *router; struct ethhdr *ethhdr = (struct ethhdr *)skb->data; struct bat_priv *priv = netdev_priv(dev); struct batman_if *batman_if; @@ -186,38 +188,36 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev) if (!orig_node) orig_node = transtable_search(ethhdr->h_dest);
- if ((orig_node) && - (orig_node->router)) { - struct neigh_node *router = orig_node->router; + router = find_router(orig_node);
- if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0) - goto unlock; - - unicast_packet = (struct unicast_packet *)skb->data; - - unicast_packet->version = COMPAT_VERSION; - /* batman packet type: unicast */ - unicast_packet->packet_type = BAT_UNICAST; - /* set unicast ttl */ - unicast_packet->ttl = TTL; - /* copy the destination for faster routing */ - memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); - - /* net_dev won't be available when not active */ - if (router->if_incoming->if_status != IF_ACTIVE) - goto unlock; - - /* don't lock while sending the packets ... we therefore - * copy the required data before sending */ - - batman_if = router->if_incoming; - memcpy(dstaddr, router->addr, ETH_ALEN); - spin_unlock_irqrestore(&orig_hash_lock, flags); - - send_skb_packet(skb, batman_if, dstaddr); - } else { + if (!router) goto unlock; - } + + /* don't lock while sending the packets ... we therefore + * copy the required data before sending */ + + batman_if = router->if_incoming; + memcpy(dstaddr, router->addr, ETH_ALEN); + + spin_unlock_irqrestore(&orig_hash_lock, flags); + + if (batman_if->if_status != IF_ACTIVE) + goto dropped; + + if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0) + goto dropped; + + unicast_packet = (struct unicast_packet *)skb->data; + + unicast_packet->version = COMPAT_VERSION; + /* batman packet type: unicast */ + unicast_packet->packet_type = BAT_UNICAST; + /* set unicast ttl */ + unicast_packet->ttl = TTL; + /* copy the destination for faster routing */ + memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); + + send_skb_packet(skb, batman_if, dstaddr); }
priv->stats.tx_packets++; diff --git a/drivers/staging/batman-adv/types.h b/drivers/staging/batman-adv/types.h index d0af489..84c3f43 100644 --- a/drivers/staging/batman-adv/types.h +++ b/drivers/staging/batman-adv/types.h @@ -52,6 +52,7 @@ struct batman_if {
/** * orig_node - structure for orig_list maintaining nodes of mesh + * @primary_addr: hosts primary interface address * @last_valid: when last packet from this node was received * @bcast_seqno_reset: time when the broadcast seqno window was reset * @batman_seqno_reset: time when the batman seqno window was reset @@ -59,9 +60,13 @@ struct batman_if { * @last_real_seqno: last and best known squence number * @last_ttl: ttl of last received packet * @last_bcast_seqno: last broadcast sequence number received by this host + * + * @candidates: how many candidates are available + * @selected: next bonding candidate */ struct orig_node { uint8_t orig[ETH_ALEN]; + uint8_t primary_addr[ETH_ALEN]; struct neigh_node *router; TYPE_OF_WORD *bcast_own; uint8_t *bcast_own_sum; @@ -78,6 +83,10 @@ struct orig_node { TYPE_OF_WORD bcast_bits[NUM_WORDS]; uint32_t last_bcast_seqno; struct list_head neigh_list; + struct { + uint8_t candidates; + struct neigh_node *selected; + } bond; };
/** @@ -92,6 +101,7 @@ struct neigh_node { uint8_t tq_index; uint8_t tq_avg; uint8_t last_ttl; + struct neigh_node *next_bond_candidate; unsigned long last_valid; TYPE_OF_WORD real_bits[NUM_WORDS]; struct orig_node *orig_node; @@ -101,6 +111,7 @@ struct neigh_node { struct bat_priv { struct net_device_stats stats; atomic_t aggregation_enabled; + atomic_t bonding_enabled; atomic_t vis_mode; atomic_t orig_interval; char num_ifaces;
Sven Eckelmann wrote:
From: Simon Wunderlich siwu@hrz.tu-chemnitz.de
[...]
Bonding is deactivated by default, and can be activated by
echo 1 > /sys/class/net/bat0/mesh/bonding
for each individual node.
Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de [sven.eckelmann@gmx.de: Rework on top of current version] Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de
I noticed that the bonding file in sysfs is not documented while working on batctl yesterday. Can you please provide a short text for http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=drive...
It would be nice to have that on Friday because I wanted to submit some remaining patches for 2.6.36 on that date.
thanks, Sven
On Monday 21 June 2010 11:04:53 Sven Eckelmann wrote:
I noticed that the bonding file in sysfs is not documented while working on batctl yesterday. Can you please provide a short text for http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=dri vers/staging/batman-adv/sysfs-class-net-mesh
I attached the new file. Will that do ?
Cheers, Marek
Marek Lindner wrote:
On Monday 21 June 2010 11:04:53 Sven Eckelmann wrote:
I noticed that the bonding file in sysfs is not documented while working on batctl yesterday. Can you please provide a short text for
http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=d ri
vers/staging/batman-adv/sysfs-class-net-mesh
I attached the new file. Will that do ?
Thanks. Added the bonding part to the linux-integration tree.
Best regards, Sven
From: Simon Wunderlich siwu@hrz.tu-chemnitz.de
This patch adds interface alternating to the new bonding feature. By default, we now try to avoid forwarding packets on the receiving interface, instead choosing alternative interfaces. This feature works only on nodes which have multiple interfaces connected to the mesh. This approach should reduce problems of the half-duplex nature of WiFi Hardware and thus increase performance.
Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de Acked-by: Marek Lindner lindner_marek@yahoo.de [sven.eckelmann@gmx.de: Rework on top of current version] Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- drivers/staging/batman-adv/hard-interface.c | 2 +- drivers/staging/batman-adv/routing.c | 72 +++++++++++++++++--------- drivers/staging/batman-adv/routing.h | 5 +- drivers/staging/batman-adv/soft-interface.c | 2 +- 4 files changed, 52 insertions(+), 29 deletions(-)
diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c index 028a7ea..ba7ddfc 100644 --- a/drivers/staging/batman-adv/hard-interface.c +++ b/drivers/staging/batman-adv/hard-interface.c @@ -512,7 +512,7 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
/* unicast packet */ case BAT_UNICAST: - ret = recv_unicast_packet(skb); + ret = recv_unicast_packet(skb, batman_if); break;
/* broadcast packet */ diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index 6a2c2d1..048795e 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c @@ -402,12 +402,6 @@ static void mark_bonding_address(struct bat_priv *bat_priv, struct batman_packet *batman_packet)
{ - /* don't care if bonding is not enabled */ - if (!atomic_read(&bat_priv->bonding_enabled)) { - orig_node->bond.candidates = 0; - return; - } - if (batman_packet->flags & PRIMARIES_FIRST_HOP) memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN); @@ -425,12 +419,6 @@ void update_bonding_candidates(struct bat_priv *bat_priv, struct neigh_node *tmp_neigh_node, *tmp_neigh_node2; struct neigh_node *first_candidate, *last_candidate;
- /* don't care if bonding is not enabled */ - if (!atomic_read(&bat_priv->bonding_enabled)) { - orig_node->bond.candidates = 0; - return; - } - /* update the candidates for this originator */ if (!orig_node->router) { orig_node->bond.candidates = 0; @@ -986,14 +974,16 @@ int recv_icmp_packet(struct sk_buff *skb)
/* find a suitable router for this originator, and use * bonding if possible. */ -struct neigh_node *find_router(struct orig_node *orig_node) +struct neigh_node *find_router(struct orig_node *orig_node, + struct batman_if *recv_if) { /* FIXME: each orig_node->batman_if will be attached to a softif */ struct bat_priv *bat_priv = netdev_priv(soft_device); struct orig_node *primary_orig_node; struct orig_node *router_orig; - struct neigh_node *router; + struct neigh_node *router, *first_candidate, *best_router; static uint8_t zero_mac[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; + int bonding_enabled;
if (!orig_node) return NULL; @@ -1001,9 +991,12 @@ struct neigh_node *find_router(struct orig_node *orig_node) if (!orig_node->router) return NULL;
- /* don't care if bonding is not enabled */ - if (!atomic_read(&bat_priv->bonding_enabled)) - return orig_node->router; + /* without bonding, the first node should + * always choose the default router. */ + + bonding_enabled = atomic_read(&bat_priv->bonding_enabled); + if (!bonding_enabled && (recv_if == NULL)) + return orig_node->router;
router_orig = orig_node->router->orig_node;
@@ -1031,19 +1024,48 @@ struct neigh_node *find_router(struct orig_node *orig_node) if (primary_orig_node->bond.candidates < 2) return orig_node->router;
- router = primary_orig_node->bond.selected;
- /* sanity check - this should never happen. */ - if (!router) - return orig_node->router; + /* all nodes between should choose a candidate which + * is is not on the interface where the packet came + * in. */ + first_candidate = primary_orig_node->bond.selected; + router = first_candidate;
- /* select the next bonding partner ... */ - primary_orig_node->bond.selected = router->next_bond_candidate; + if (bonding_enabled) { + /* in the bonding case, send the packets in a round + * robin fashion over the remaining interfaces. */ + do { + /* recv_if == NULL on the first node. */ + if (router->if_incoming != recv_if) + break; + + router = router->next_bond_candidate; + } while (router != first_candidate); + + primary_orig_node->bond.selected = router->next_bond_candidate; + + } else { + /* if bonding is disabled, use the best of the + * remaining candidates which are not using + * this interface. */ + best_router = first_candidate; + + do { + /* recv_if == NULL on the first node. */ + if ((router->if_incoming != recv_if) && + (router->tq_avg > best_router->tq_avg)) + best_router = router; + + router = router->next_bond_candidate; + } while (router != first_candidate); + + router = best_router; + }
return router; }
-int recv_unicast_packet(struct sk_buff *skb) +int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if) { struct unicast_packet *unicast_packet; struct orig_node *orig_node; @@ -1095,7 +1117,7 @@ int recv_unicast_packet(struct sk_buff *skb) orig_node = ((struct orig_node *) hash_find(orig_hash, unicast_packet->dest));
- router = find_router(orig_node); + router = find_router(orig_node, recv_if);
if (!router) { spin_unlock_irqrestore(&orig_hash_lock, flags); diff --git a/drivers/staging/batman-adv/routing.h b/drivers/staging/batman-adv/routing.h index 0e33d22..43387a2 100644 --- a/drivers/staging/batman-adv/routing.h +++ b/drivers/staging/batman-adv/routing.h @@ -30,11 +30,12 @@ void update_routes(struct orig_node *orig_node, struct neigh_node *neigh_node, unsigned char *hna_buff, int hna_buff_len); int recv_icmp_packet(struct sk_buff *skb); -int recv_unicast_packet(struct sk_buff *skb); +int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if); int recv_bcast_packet(struct sk_buff *skb); int recv_vis_packet(struct sk_buff *skb); int recv_bat_packet(struct sk_buff *skb, struct batman_if *batman_if); -struct neigh_node *find_router(struct orig_node *orig_node); +struct neigh_node *find_router(struct orig_node *orig_node, + struct batman_if *recv_if); void update_bonding_candidates(struct bat_priv *bat_priv, struct orig_node *orig_node); diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c index 37fd565..ef7860d 100644 --- a/drivers/staging/batman-adv/soft-interface.c +++ b/drivers/staging/batman-adv/soft-interface.c @@ -188,7 +188,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev) if (!orig_node) orig_node = transtable_search(ethhdr->h_dest);
- router = find_router(orig_node); + router = find_router(orig_node, NULL);
if (!router) goto unlock;
From: Daniel Seither post@tiwoc.de
The standard layer 3 ping utility can use the record route (RR) option of IP to collect route data for sent ping messages (ping -R). This patch introduces comparable functionality for batman-adv ICMP messages.
The patch adds a second batman ICMP packet format (icmp_packet_rr) such that up to 17 MAC addresses can be recorded (sufficient for up to 8 hops per direction). When no RR is wanted, the old icmp_packet without the RR overhead can be sent.
Signed-off-by: Daniel Seither post@tiwoc.de Signed-off-by: Marek Lindner lindner_marek@yahoo.de [sven.eckelmann@gmx.de: Rework on top of current version] Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- drivers/staging/batman-adv/icmp_socket.c | 45 ++++++++++++++++++------------ drivers/staging/batman-adv/icmp_socket.h | 3 +- drivers/staging/batman-adv/packet.h | 17 +++++++++++ drivers/staging/batman-adv/routing.c | 43 ++++++++++++++++++---------- drivers/staging/batman-adv/types.h | 3 +- 5 files changed, 76 insertions(+), 35 deletions(-)
diff --git a/drivers/staging/batman-adv/icmp_socket.c b/drivers/staging/batman-adv/icmp_socket.c index d4411cb..08a5f7b 100644 --- a/drivers/staging/batman-adv/icmp_socket.c +++ b/drivers/staging/batman-adv/icmp_socket.c @@ -32,7 +32,8 @@ static struct socket_client *socket_client_hash[256];
static void bat_socket_add_packet(struct socket_client *socket_client, - struct icmp_packet *icmp_packet); + struct icmp_packet_rr *icmp_packet, + size_t icmp_len);
void bat_socket_init(void) { @@ -110,6 +111,7 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf, struct socket_client *socket_client = (struct socket_client *)file->private_data; struct socket_packet *socket_packet; + size_t packet_len; int error; unsigned long flags;
@@ -138,14 +140,15 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf, spin_unlock_irqrestore(&socket_client->lock, flags);
error = __copy_to_user(buf, &socket_packet->icmp_packet, - sizeof(struct icmp_packet)); + socket_packet->icmp_len);
+ packet_len = socket_packet->icmp_len; kfree(socket_packet);
if (error) return -EFAULT;
- return sizeof(struct icmp_packet); + return packet_len; }
static ssize_t bat_socket_write(struct file *file, const char __user *buff, @@ -153,9 +156,10 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, { struct socket_client *socket_client = (struct socket_client *)file->private_data; - struct icmp_packet icmp_packet; + struct icmp_packet_rr icmp_packet; struct orig_node *orig_node; struct batman_if *batman_if; + size_t packet_len = sizeof(struct icmp_packet); uint8_t dstaddr[ETH_ALEN]; unsigned long flags;
@@ -166,10 +170,13 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, return -EINVAL; }
- if (!access_ok(VERIFY_READ, buff, sizeof(struct icmp_packet))) + if (len >= sizeof(struct icmp_packet_rr)) + packet_len = sizeof(struct icmp_packet_rr); + + if (!access_ok(VERIFY_READ, buff, packet_len)) return -EFAULT;
- if (__copy_from_user(&icmp_packet, buff, sizeof(icmp_packet))) + if (__copy_from_user(&icmp_packet, buff, packet_len)) return -EFAULT;
if (icmp_packet.packet_type != BAT_ICMP) { @@ -191,7 +198,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, if (icmp_packet.version != COMPAT_VERSION) { icmp_packet.msg_type = PARAMETER_PROBLEM; icmp_packet.ttl = COMPAT_VERSION; - bat_socket_add_packet(socket_client, &icmp_packet); + bat_socket_add_packet(socket_client, &icmp_packet, packet_len); goto out; }
@@ -218,13 +225,13 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff, if (batman_if->if_status != IF_ACTIVE) goto dst_unreach;
- memcpy(icmp_packet.orig, - batman_if->net_dev->dev_addr, - ETH_ALEN); + memcpy(icmp_packet.orig, batman_if->net_dev->dev_addr, ETH_ALEN); + + if (packet_len == sizeof(struct icmp_packet_rr)) + memcpy(icmp_packet.rr, batman_if->net_dev->dev_addr, ETH_ALEN);
send_raw_packet((unsigned char *)&icmp_packet, - sizeof(struct icmp_packet), - batman_if, dstaddr); + packet_len, batman_if, dstaddr);
goto out;
@@ -232,7 +239,7 @@ unlock: spin_unlock_irqrestore(&orig_hash_lock, flags); dst_unreach: icmp_packet.msg_type = DESTINATION_UNREACHABLE; - bat_socket_add_packet(socket_client, &icmp_packet); + bat_socket_add_packet(socket_client, &icmp_packet, packet_len); out: return len; } @@ -278,7 +285,8 @@ err: }
static void bat_socket_add_packet(struct socket_client *socket_client, - struct icmp_packet *icmp_packet) + struct icmp_packet_rr *icmp_packet, + size_t icmp_len) { struct socket_packet *socket_packet; unsigned long flags; @@ -289,8 +297,8 @@ static void bat_socket_add_packet(struct socket_client *socket_client, return;
INIT_LIST_HEAD(&socket_packet->list); - memcpy(&socket_packet->icmp_packet, icmp_packet, - sizeof(struct icmp_packet)); + memcpy(&socket_packet->icmp_packet, icmp_packet, icmp_len); + socket_packet->icmp_len = icmp_len;
spin_lock_irqsave(&socket_client->lock, flags);
@@ -319,10 +327,11 @@ static void bat_socket_add_packet(struct socket_client *socket_client, wake_up(&socket_client->queue_wait); }
-void bat_socket_receive_packet(struct icmp_packet *icmp_packet) +void bat_socket_receive_packet(struct icmp_packet_rr *icmp_packet, + size_t icmp_len) { struct socket_client *hash = socket_client_hash[icmp_packet->uid];
if (hash) - bat_socket_add_packet(hash, icmp_packet); + bat_socket_add_packet(hash, icmp_packet, icmp_len); } diff --git a/drivers/staging/batman-adv/icmp_socket.h b/drivers/staging/batman-adv/icmp_socket.h index 5ad73da..2dc954a 100644 --- a/drivers/staging/batman-adv/icmp_socket.h +++ b/drivers/staging/batman-adv/icmp_socket.h @@ -25,4 +25,5 @@
void bat_socket_init(void); int bat_socket_setup(struct bat_priv *bat_priv); -void bat_socket_receive_packet(struct icmp_packet *icmp_packet); +void bat_socket_receive_packet(struct icmp_packet_rr *icmp_packet, + size_t icmp_len); diff --git a/drivers/staging/batman-adv/packet.h b/drivers/staging/batman-adv/packet.h index d0d35ea..8a04418 100644 --- a/drivers/staging/batman-adv/packet.h +++ b/drivers/staging/batman-adv/packet.h @@ -69,6 +69,23 @@ struct icmp_packet { uint8_t uid; } __attribute__((packed));
+#define BAT_RR_LEN 16 + +/* icmp_packet_rr must start with all fields from imcp_packet + as this is assumed by code that handles ICMP packets */ +struct icmp_packet_rr { + uint8_t packet_type; + uint8_t version; /* batman version field */ + uint8_t msg_type; /* see ICMP message types above */ + uint8_t ttl; + uint8_t dst[6]; + uint8_t orig[6]; + uint16_t seqno; + uint8_t uid; + uint8_t rr_cur; + uint8_t rr[BAT_RR_LEN][ETH_ALEN]; +} __attribute__((packed)); + struct unicast_packet { uint8_t packet_type; uint8_t version; /* batman version field */ diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index 048795e..acd8f74 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c @@ -765,10 +765,10 @@ int recv_bat_packet(struct sk_buff *skb, return NET_RX_SUCCESS; }
-static int recv_my_icmp_packet(struct sk_buff *skb) +static int recv_my_icmp_packet(struct sk_buff *skb, size_t icmp_len) { struct orig_node *orig_node; - struct icmp_packet *icmp_packet; + struct icmp_packet_rr *icmp_packet; struct ethhdr *ethhdr; struct sk_buff *skb_old; struct batman_if *batman_if; @@ -776,12 +776,12 @@ static int recv_my_icmp_packet(struct sk_buff *skb) unsigned long flags; uint8_t dstaddr[ETH_ALEN];
- icmp_packet = (struct icmp_packet *)skb->data; + icmp_packet = (struct icmp_packet_rr *)skb->data; ethhdr = (struct ethhdr *)skb_mac_header(skb);
/* add data to device queue */ if (icmp_packet->msg_type != ECHO_REQUEST) { - bat_socket_receive_packet(icmp_packet); + bat_socket_receive_packet(icmp_packet, icmp_len); return NET_RX_DROP; }
@@ -803,13 +803,12 @@ static int recv_my_icmp_packet(struct sk_buff *skb)
/* create a copy of the skb, if needed, to modify it. */ skb_old = NULL; - if (!skb_clone_writable(skb, sizeof(struct icmp_packet))) { + if (!skb_clone_writable(skb, icmp_len)) { skb_old = skb; skb = skb_copy(skb, GFP_ATOMIC); if (!skb) return NET_RX_DROP; - - icmp_packet = (struct icmp_packet *)skb->data; + icmp_packet = (struct icmp_packet_rr *)skb->data; ethhdr = (struct ethhdr *)skb_mac_header(skb); kfree_skb(skb_old); } @@ -828,7 +827,7 @@ static int recv_my_icmp_packet(struct sk_buff *skb) return ret; }
-static int recv_icmp_ttl_exceeded(struct sk_buff *skb) +static int recv_icmp_ttl_exceeded(struct sk_buff *skb, size_t icmp_len) { struct orig_node *orig_node; struct icmp_packet *icmp_packet; @@ -867,7 +866,7 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb) spin_unlock_irqrestore(&orig_hash_lock, flags);
/* create a copy of the skb, if needed, to modify it. */ - if (!skb_clone_writable(skb, sizeof(struct icmp_packet))) { + if (!skb_clone_writable(skb, icmp_len)) { skb_old = skb; skb = skb_copy(skb, GFP_ATOMIC); if (!skb) @@ -894,7 +893,7 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb)
int recv_icmp_packet(struct sk_buff *skb) { - struct icmp_packet *icmp_packet; + struct icmp_packet_rr *icmp_packet; struct ethhdr *ethhdr; struct orig_node *orig_node; struct sk_buff *skb_old; @@ -904,6 +903,12 @@ int recv_icmp_packet(struct sk_buff *skb) unsigned long flags; uint8_t dstaddr[ETH_ALEN];
+ /** + * we truncate all incoming icmp packets if they don't match our size + */ + if (skb_headlen(skb) >= sizeof(struct icmp_packet_rr)) + hdr_size = sizeof(struct icmp_packet_rr); + /* drop packet if it has not necessary minimum size */ if (skb_headlen(skb) < hdr_size) return NET_RX_DROP; @@ -922,15 +927,23 @@ int recv_icmp_packet(struct sk_buff *skb) if (!is_my_mac(ethhdr->h_dest)) return NET_RX_DROP;
- icmp_packet = (struct icmp_packet *)skb->data; + icmp_packet = (struct icmp_packet_rr *)skb->data; + + /* add record route information if not full */ + if ((hdr_size == sizeof(struct icmp_packet_rr)) && + (icmp_packet->rr_cur < BAT_RR_LEN)) { + memcpy(&(icmp_packet->rr[icmp_packet->rr_cur]), + ethhdr->h_dest, ETH_ALEN); + icmp_packet->rr_cur++; + }
/* packet for me */ if (is_my_mac(icmp_packet->dst)) - return recv_my_icmp_packet(skb); + return recv_my_icmp_packet(skb, hdr_size);
/* TTL exceeded */ if (icmp_packet->ttl < 2) - return recv_icmp_ttl_exceeded(skb); + return recv_icmp_ttl_exceeded(skb, hdr_size);
ret = NET_RX_DROP;
@@ -949,12 +962,12 @@ int recv_icmp_packet(struct sk_buff *skb) spin_unlock_irqrestore(&orig_hash_lock, flags);
/* create a copy of the skb, if needed, to modify it. */ - if (!skb_clone_writable(skb, sizeof(struct icmp_packet))) { + if (!skb_clone_writable(skb, hdr_size)) { skb_old = skb; skb = skb_copy(skb, GFP_ATOMIC); if (!skb) return NET_RX_DROP; - icmp_packet = (struct icmp_packet *)skb->data; + icmp_packet = (struct icmp_packet_rr *)skb->data; ethhdr = (struct ethhdr *)skb_mac_header(skb); kfree_skb(skb_old); } diff --git a/drivers/staging/batman-adv/types.h b/drivers/staging/batman-adv/types.h index 84c3f43..e1fc460 100644 --- a/drivers/staging/batman-adv/types.h +++ b/drivers/staging/batman-adv/types.h @@ -130,7 +130,8 @@ struct socket_client {
struct socket_packet { struct list_head list; - struct icmp_packet icmp_packet; + size_t icmp_len; + struct icmp_packet_rr icmp_packet; };
struct hna_local_entry {
On Sat, Jun 19, 2010 at 02:51:45AM +0200, Sven Eckelmann wrote:
Hi,
here are patches targetted for 2.6.36. They are made on top of patches you have already received in 1275852501-28523-1-git-send-email-sven.eckelmann@gmx.de :
- Staging: batman-adv: remove redundant struct declaration
- Staging: batman-adv: Move device for icmp injection to debugfs
- Staging: batman-adv: Move tables from sysfs to debugfs
- Staging: batman-adv: convert all sysfs files to single value files
- Staging: batman-adv: Adding netfilter-bridge hooks
- Staging: batman-adv: Add information about batman-adv sysfs entries
- Staging: batman-adv: remove superfluous hint to "translation table"
- Staging: batman-adv: convert vis_interval into define
- Staging: batman-adv: Convert MAC_FMT to %pM
They also depend on patches not yet applied on 2.6.35, but sent to you:
- Staging: batman-adv: return -EFAULT on copy_to_user errors
- Staging: batman-adv: fix function prototype
Something's still not right. I applied the above 2 patches, and then tried to apply the 1/8 patch above: Subject: [PATCH 1/8] Staging: batman-adv: Mark locally used symbols as static
It fails with: patching file drivers/staging/batman-adv/bitarray.c patching file drivers/staging/batman-adv/bitarray.h patching file drivers/staging/batman-adv/hash.c patching file drivers/staging/batman-adv/hash.h patching file drivers/staging/batman-adv/originator.c patching file drivers/staging/batman-adv/originator.h patching file drivers/staging/batman-adv/routing.c patching file drivers/staging/batman-adv/routing.h patching file drivers/staging/batman-adv/send.c patching file drivers/staging/batman-adv/send.h patching file drivers/staging/batman-adv/soft-interface.c patching file drivers/staging/batman-adv/soft-interface.h patching file drivers/staging/batman-adv/translation-table.c Hunk #2 succeeded at 250 (offset 5 lines). Hunk #3 succeeded at 442 with fuzz 1 (offset 16 lines). patching file drivers/staging/batman-adv/translation-table.h Hunk #1 FAILED at 26. 1 out of 1 hunk FAILED -- saving rejects to file drivers/staging/batman-adv/translation-table.h.rej patching file drivers/staging/batman-adv/vis.c patching file drivers/staging/batman-adv/vis.h Hunk #1 FAILED at 44. 1 out of 1 hunk FAILED -- saving rejects to file drivers/staging/batman-adv/vis.h.rej
So, any thoughts?
confused,
greg k-h
Greg KH wrote:
On Sat, Jun 19, 2010 at 02:51:45AM +0200, Sven Eckelmann wrote:
Hi,
here are patches targetted for 2.6.36. They are made on top of patches you have
already received in 1275852501-28523-1-git-send-email-sven.eckelmann@gmx.de :
- Staging: batman-adv: remove redundant struct declaration
- Staging: batman-adv: Move device for icmp injection to debugfs
- Staging: batman-adv: Move tables from sysfs to debugfs
- Staging: batman-adv: convert all sysfs files to single value files
- Staging: batman-adv: Adding netfilter-bridge hooks
- Staging: batman-adv: Add information about batman-adv sysfs entries
- Staging: batman-adv: remove superfluous hint to "translation table"
- Staging: batman-adv: convert vis_interval into define
- Staging: batman-adv: Convert MAC_FMT to %pM
They also depend on patches not yet applied on 2.6.35, but sent to you:
- Staging: batman-adv: return -EFAULT on copy_to_user errors
- Staging: batman-adv: fix function prototype
Something's still not right. I applied the above 2 patches, and then tried to apply the 1/8 patch above: Subject: [PATCH 1/8] Staging: batman-adv: Mark locally used symbols as static
It fails with: patching file drivers/staging/batman-adv/bitarray.c patching file drivers/staging/batman-adv/bitarray.h patching file drivers/staging/batman-adv/hash.c patching file drivers/staging/batman-adv/hash.h patching file drivers/staging/batman-adv/originator.c patching file drivers/staging/batman-adv/originator.h patching file drivers/staging/batman-adv/routing.c patching file drivers/staging/batman-adv/routing.h patching file drivers/staging/batman-adv/send.c patching file drivers/staging/batman-adv/send.h patching file drivers/staging/batman-adv/soft-interface.c patching file drivers/staging/batman-adv/soft-interface.h patching file drivers/staging/batman-adv/translation-table.c Hunk #2 succeeded at 250 (offset 5 lines). Hunk #3 succeeded at 442 with fuzz 1 (offset 16 lines). patching file drivers/staging/batman-adv/translation-table.h Hunk #1 FAILED at 26. 1 out of 1 hunk FAILED -- saving rejects to file drivers/staging/batman-adv/translation-table.h.rej patching file drivers/staging/batman-adv/vis.c patching file drivers/staging/batman-adv/vis.h Hunk #1 FAILED at 44. 1 out of 1 hunk FAILED -- saving rejects to file drivers/staging/batman-adv/vis.h.rej
So, any thoughts?
I have currently no idea what you try to achieve by applying all patches out of order, but you have done following:
* Staging: batman-adv: return -EFAULT on copy_to_user errors * Staging: batman-adv: fix function prototype * Staging: batman-adv: Mark locally used symbols as static => of course fails because it was applied out of order and misses 9 patches inbetween
Right thing to do: * Staging: batman-adv: return -EFAULT on copy_to_user errors * Staging: batman-adv: fix function prototype * Staging: batman-adv: remove redundant struct declaration * Staging: batman-adv: Move device for icmp injection to debugfs * Staging: batman-adv: Move tables from sysfs to debugfs * Staging: batman-adv: convert all sysfs files to single value files * Staging: batman-adv: Adding netfilter-bridge hooks * Staging: batman-adv: Add information about batman-adv sysfs entries * Staging: batman-adv: remove superfluous hint to "translation table" * Staging: batman-adv: convert vis_interval into define * Staging: batman-adv: Convert MAC_FMT to %pM * Staging: batman-adv: Mark locally used symbols as static * Staging: batman-adv: Ignore debugfs on kernels without debugfs support * Staging: batman-adv: permit setting ogm interval to JITTER*2 * Staging: batman-adv: Add release information for version 2010.0.0 * Staging: batman-adv: 32bit sequence number and TTL for broadcasts * Staging: batman-adv: Add bonding functionality * Staging: batman-adv: bonding and interface alternating * Staging: batman-adv: record route for ICMP messages
Just saved my patch queues as 2.6.35.mbox, 2.6.36_renewed.mbox, 2.6.36_2.mbox and created a temporary gregkh branch of linux-next/master:
$ git am -3 ~/2.6.35.mbox Applying: Staging: batman-adv: return -EFAULT on copy_to_user errors Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... No changes -- Patch already applied. Applying: Staging: batman-adv: fix function prototype Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... No changes -- Patch already applied. $ git am -3 ~/2.6.36_renewed.mbox Applying: Staging: batman-adv: remove redundant struct declaration Applying: Staging: batman-adv: Move device for icmp injection to debugfs Applying: Staging: batman-adv: Move tables from sysfs to debugfs Applying: Staging: batman-adv: convert all sysfs files to single value files Applying: Staging: batman-adv: Adding netfilter-bridge hooks Applying: Staging: batman-adv: Add information about batman-adv sysfs entries Applying: Staging: batman-adv: remove superfluous hint to "translation table" Applying: Staging: batman-adv: convert vis_interval into define Applying: Staging: batman-adv: Convert MAC_FMT to %pM $ git am -3 ~/2.6.36_2.mbox Applying: Staging: batman-adv: Mark locally used symbols as static Applying: Staging: batman-adv: Ignore debugfs on kernels without debugfs support Applying: Staging: batman-adv: permit setting ogm interval to JITTER*2 Applying: Staging: batman-adv: Add release information for version 2010.0.0 Applying: Staging: batman-adv: 32bit sequence number and TTL for broadcasts Applying: Staging: batman-adv: Add bonding functionality Applying: Staging: batman-adv: bonding and interface alternating Applying: Staging: batman-adv: record route for ICMP messages
So, linux-next has already following patches applied: * Staging: batman-adv: return -EFAULT on copy_to_user errors * Staging: batman-adv: fix function prototype
All remaining patches are missing and apply cleanly.
Now the same for staging-next (branch staging-next): $ git am -3 ~/2.6.35.mbox Applying: Staging: batman-adv: return -EFAULT on copy_to_user errors Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... No changes -- Patch already applied. Applying: Staging: batman-adv: fix function prototype Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging drivers/staging/batman-adv/bat_sysfs.c No changes -- Patch already applied. $ git am -3 ~/2.6.36_renewed.mbox Applying: Staging: batman-adv: remove redundant struct declaration Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... No changes -- Patch already applied. Applying: Staging: batman-adv: Move device for icmp injection to debugfs Applying: Staging: batman-adv: Move tables from sysfs to debugfs Applying: Staging: batman-adv: convert all sysfs files to single value files Applying: Staging: batman-adv: Adding netfilter-bridge hooks Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... No changes -- Patch already applied. Applying: Staging: batman-adv: Add information about batman-adv sysfs entries Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... No changes -- Patch already applied. Applying: Staging: batman-adv: remove superfluous hint to "translation table" Applying: Staging: batman-adv: convert vis_interval into define Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... No changes -- Patch already applied. Applying: Staging: batman-adv: Convert MAC_FMT to %pM $ git am -3 ~/2.6.36_2.mbox Applying: Staging: batman-adv: Mark locally used symbols as static Applying: Staging: batman-adv: Ignore debugfs on kernels without debugfs support Applying: Staging: batman-adv: permit setting ogm interval to JITTER*2 Applying: Staging: batman-adv: Add release information for version 2010.0.0 Applying: Staging: batman-adv: 32bit sequence number and TTL for broadcasts Applying: Staging: batman-adv: Add bonding functionality Applying: Staging: batman-adv: bonding and interface alternating Applying: Staging: batman-adv: record route for ICMP messages
More patches are already in staging-next, but all remaining apply cleanly.
A diff between those two repositories only give me a change which was applied by the net folks for their 2.6.36 branch:
diff -ruN drivers/staging/batman-adv/hard-interface.c ../linux-next/drivers/staging/batman-adv/hard-interface.c --- drivers/staging/batman-adv/hard-interface.c 2010-06-22 00:55:28.360018720 +0200 +++ ../linux-next/drivers/staging/batman-adv/hard-interface.c 2010-06-22 00:52:26.491518520 +0200 @@ -72,7 +72,7 @@ #endif
/* Device is being bridged */ - /* if (net_dev->br_port != NULL) + /* if (net_dev->priv_flags & IFF_BRIDGE_PORT) return 0; */
return 1;
So I would say that everything should work as expected.
Best regards, Sven
On Tue, Jun 22, 2010 at 12:59:47AM +0200, Sven Eckelmann wrote:
Greg KH wrote:
On Sat, Jun 19, 2010 at 02:51:45AM +0200, Sven Eckelmann wrote:
Hi,
here are patches targetted for 2.6.36. They are made on top of patches you have
already received in 1275852501-28523-1-git-send-email-sven.eckelmann@gmx.de :
- Staging: batman-adv: remove redundant struct declaration
- Staging: batman-adv: Move device for icmp injection to debugfs
- Staging: batman-adv: Move tables from sysfs to debugfs
- Staging: batman-adv: convert all sysfs files to single value files
- Staging: batman-adv: Adding netfilter-bridge hooks
- Staging: batman-adv: Add information about batman-adv sysfs entries
- Staging: batman-adv: remove superfluous hint to "translation table"
- Staging: batman-adv: convert vis_interval into define
- Staging: batman-adv: Convert MAC_FMT to %pM
They also depend on patches not yet applied on 2.6.35, but sent to you:
- Staging: batman-adv: return -EFAULT on copy_to_user errors
- Staging: batman-adv: fix function prototype
Something's still not right. I applied the above 2 patches, and then tried to apply the 1/8 patch above: Subject: [PATCH 1/8] Staging: batman-adv: Mark locally used symbols as static
It fails with: patching file drivers/staging/batman-adv/bitarray.c patching file drivers/staging/batman-adv/bitarray.h patching file drivers/staging/batman-adv/hash.c patching file drivers/staging/batman-adv/hash.h patching file drivers/staging/batman-adv/originator.c patching file drivers/staging/batman-adv/originator.h patching file drivers/staging/batman-adv/routing.c patching file drivers/staging/batman-adv/routing.h patching file drivers/staging/batman-adv/send.c patching file drivers/staging/batman-adv/send.h patching file drivers/staging/batman-adv/soft-interface.c patching file drivers/staging/batman-adv/soft-interface.h patching file drivers/staging/batman-adv/translation-table.c Hunk #2 succeeded at 250 (offset 5 lines). Hunk #3 succeeded at 442 with fuzz 1 (offset 16 lines). patching file drivers/staging/batman-adv/translation-table.h Hunk #1 FAILED at 26. 1 out of 1 hunk FAILED -- saving rejects to file drivers/staging/batman-adv/translation-table.h.rej patching file drivers/staging/batman-adv/vis.c patching file drivers/staging/batman-adv/vis.h Hunk #1 FAILED at 44. 1 out of 1 hunk FAILED -- saving rejects to file drivers/staging/batman-adv/vis.h.rej
So, any thoughts?
I have currently no idea what you try to achieve by applying all patches out of order, but you have done following:
- Staging: batman-adv: return -EFAULT on copy_to_user errors
- Staging: batman-adv: fix function prototype
- Staging: batman-adv: Mark locally used symbols as static => of course fails because it was applied out of order and misses 9 patches inbetween
Ick, you are right, I had thought the 8 patches you sent me were the ones that I should start with as I had already applied some of the previous series.
So, to make it dirt-simple for me, so my simple mind can figure it out, can you resend the patches that I need to apply that are not in my staging-next tree?
thanks,
greg k-h
On Tue, Jun 22, 2010 at 01:23:32AM +0200, Sven Eckelmann wrote:
Greg KH wrote:
So, to make it dirt-simple for me, so my simple mind can figure it out, can you resend the patches that I need to apply that are not in my staging-next tree?
Yes, of course. I will sent them as response to this mail.
Thanks, I got them all and applied them. Hopefully we should be all synced up now, right?
So sorry for the confusion,
greg k-h
On Tue, Jun 22, 2010 at 02:06:46PM -0700, Greg KH wrote:
On Tue, Jun 22, 2010 at 01:23:32AM +0200, Sven Eckelmann wrote:
Greg KH wrote:
So, to make it dirt-simple for me, so my simple mind can figure it out, can you resend the patches that I need to apply that are not in my staging-next tree?
Yes, of course. I will sent them as response to this mail.
Thanks, I got them all and applied them. Hopefully we should be all synced up now, right?
The count seems to be correct - I have to check later if the content looks fine too, but have not doubts that everything is fine.
I was asked to remind you about the mail regarding the possibility to move from staging to net.
https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2010-June/002881.html
thanks, Sven
On Tue, Jun 22, 2010 at 11:25:59PM +0200, Sven Eckelmann wrote:
On Tue, Jun 22, 2010 at 02:06:46PM -0700, Greg KH wrote:
On Tue, Jun 22, 2010 at 01:23:32AM +0200, Sven Eckelmann wrote:
Greg KH wrote:
So, to make it dirt-simple for me, so my simple mind can figure it out, can you resend the patches that I need to apply that are not in my staging-next tree?
Yes, of course. I will sent them as response to this mail.
Thanks, I got them all and applied them. Hopefully we should be all synced up now, right?
The count seems to be correct - I have to check later if the content looks fine too, but have not doubts that everything is fine.
I was asked to remind you about the mail regarding the possibility to move from staging to net.
Heh, yes, that's still in my queue, sorry, will go do that now...
thanks,
greg k-h
b.a.t.m.a.n@lists.open-mesh.org