batman-adv: Prefix non-static functions with batadv_
PATCH v2 1/3 batman-adv: Prefix non-static functions with batadv_
batman-adv can be compiled as part of the kernel instead of an module. In that case the linker will see all non-static symbols of batman-adv and all other non-static symbols of the kernel. This could lead to symbol collisions. A prefix for the batman-adv symbols that defines their private namespace avoids such a problem.
--- bat_algo.h | 2 +- bat_debugfs.c | 31 +++---- bat_debugfs.h | 8 +- bat_iv_ogm.c | 130 ++++++++++++++-------------- bat_sysfs.c | 34 ++++---- bat_sysfs.h | 13 +-- bitarray.c | 8 +- bitarray.h | 4 +- bridge_loop_avoidance.c | 46 +++++----- bridge_loop_avoidance.h | 65 +++++++------- compat.c | 8 +- compat.h | 2 +- distributed-arp-table.c | 46 +++++----- distributed-arp-table.h | 67 ++++++++------- gateway_client.c | 93 ++++++++++---------- gateway_client.h | 26 +++--- gateway_common.c | 9 +- gateway_common.h | 5 +- hard-interface.c | 72 ++++++++-------- hard-interface.h | 22 ++--- hash.c | 4 +- hash.h | 6 +- icmp_socket.c | 20 ++--- icmp_socket.h | 8 +- main.c | 109 ++++++++++++------------ main.h | 46 +++++----- originator.c | 65 +++++++------- originator.h | 21 ++--- ring_buffer.c | 5 +- ring_buffer.h | 5 +- routing.c | 215 ++++++++++++++++++++++++----------------------- routing.h | 52 ++++++------ send.c | 47 ++++++----- send.h | 17 ++-- soft-interface.c | 68 +++++++-------- soft-interface.h | 13 ++- translation-table.c | 150 +++++++++++++++++---------------- translation-table.h | 71 +++++++++------- unicast.c | 62 +++++++------- unicast.h | 30 ++++--- vis.c | 57 +++++++------ vis.h | 18 ++-- 42 files changed, 925 insertions(+), 855 deletions(-)
bat_algo.h +1 -1
@@ -22,6 +22,6 @@#ifndef _NET_BATMAN_ADV_BAT_ALGO_H_#define _NET_BATMAN_ADV_BAT_ALGO_H_ -int bat_iv_init (void ); +int batadv_iv_init (void );#endif /* _NET_BATMAN_ADV_BAT_ALGO_H_ */
bat_debugfs.c +16 -15
@@ -76,7 +76,7 @@ static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...)return 0 ; } -int debug_log (struct bat_priv *bat_priv,const char *fmt, ...) +int batadv_debug_log (struct bat_priv *bat_priv,const char *fmt, ...) {va_list args;char tmp_log_buf[256 ];
@@ -94,13 +94,13 @@ static int log_open(struct inode *inode, struct file *file) {nonseekable_open (inode, file); file->private_data = inode->i_private; -inc_module_count (); +batadv_inc_module_count ();return 0 ; }static int log_release (struct inode *inode,struct file *file) { -dec_module_count (); +batadv_dec_module_count ();return 0 ; }
@@ -224,45 +224,46 @@ static void debug_log_cleanup(struct bat_priv *bat_priv)static int bat_algorithms_open (struct inode *inode,struct file *file) { -return single_open (file, bat_algo_seq_print_text,NULL ); +return single_open (file, batadv_algo_seq_print_text,NULL ); }static int originators_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private; -return single_open (file, orig_seq_print_text, net_dev); +return single_open (file, batadv_orig_seq_print_text, net_dev); }static int gateways_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private; -return single_open (file, gw_client_seq_print_text, net_dev); +return single_open (file, batadv_gw_client_seq_print_text, net_dev); }static int transtable_global_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private; -return single_open (file, tt_global_seq_print_text, net_dev); +return single_open (file, batadv_tt_global_seq_print_text, net_dev); }#ifdef CONFIG_BATMAN_ADV_BLA static int bla_claim_table_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private; -return single_open (file, bla_claim_table_seq_print_text, net_dev); +return single_open (file, batadv_bla_claim_table_seq_print_text, + net_dev); }#endif static int transtable_local_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private; -return single_open (file, tt_local_seq_print_text, net_dev); +return single_open (file, batadv_tt_local_seq_print_text, net_dev); }static int vis_data_open (struct inode *inode,struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private; -return single_open (file, vis_seq_print_text, net_dev); +return single_open (file, batadv_vis_seq_print_text, net_dev); }struct bat_debuginfo {
@@ -304,7 +305,7 @@ static struct bat_debuginfo *mesh_debuginfos[] = { NULL, }; -void debugfs_init (void ) +void batadv_debugfs_init (void ) {struct bat_debuginfo *bat_debug;struct dentry *file;
@@ -327,7 +328,7 @@ out:return ; } -void debugfs_destroy (void ) +void batadv_debugfs_destroy (void ) {if (bat_debugfs) {debugfs_remove_recursive (bat_debugfs);
@@ -335,7 +336,7 @@ void debugfs_destroy(void) } } -int debugfs_add_meshif (struct net_device *dev) +int batadv_debugfs_add_meshif (struct net_device *dev) {struct bat_priv *bat_priv =netdev_priv (dev);struct bat_debuginfo **bat_debug;
@@ -348,7 +349,7 @@ int debugfs_add_meshif(struct net_device *dev)if (!bat_priv->debug_dir) goto out; -bat_socket_setup (bat_priv); +batadv_socket_setup (bat_priv);debug_log_setup (bat_priv);for (bat_debug = mesh_debuginfos; *bat_debug; ++bat_debug) {
@@ -375,7 +376,7 @@ out:#endif /* CONFIG_DEBUG_FS */ } -void debugfs_del_meshif (struct net_device *dev) +void batadv_debugfs_del_meshif (struct net_device *dev) {struct bat_priv *bat_priv =netdev_priv (dev);
bat_debugfs.h +4 -4
@@ -25,9 +25,9 @@#define DEBUGFS_BAT_SUBDIR "batman_adv" -void debugfs_init (void ); -void debugfs_destroy (void ); -int debugfs_add_meshif (struct net_device *dev); -void debugfs_del_meshif (struct net_device *dev); +void batadv_debugfs_init (void ); +void batadv_debugfs_destroy (void ); +int batadv_debugfs_add_meshif (struct net_device *dev); +void batadv_debugfs_del_meshif (struct net_device *dev);#endif /* _NET_BATMAN_ADV_DEBUGFS_H_ */
bat_iv_ogm.c +68 -62
363 lines not on this page · raw message
bat_sysfs.c +17 -17
@@ -326,7 +326,7 @@ static ssize_t show_bat_algo(struct kobject *kobj, struct attribute *attr,static void post_gw_deselect (struct net_device *net_dev) {struct bat_priv *bat_priv =netdev_priv (net_dev); -gw_deselect (bat_priv); +batadv_gw_deselect (bat_priv); } static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr,
@@ -397,7 +397,7 @@ static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr,bat_info (net_dev,"Changing gw mode from: %s to: %s\n" , curr_gw_mode_str, buff); -gw_deselect (bat_priv); +batadv_gw_deselect (bat_priv);atomic_set (&bat_priv->gw_mode, (unsigned int )gw_mode_tmp);return count; }
@@ -409,7 +409,7 @@ static ssize_t show_gw_bwidth(struct kobject *kobj, struct attribute *attr,int down, up;int gw_bandwidth =atomic_read (&bat_priv->gw_bandwidth); -gw_bandwidth_to_kbit (gw_bandwidth, &down, &up); +batadv_gw_bandwidth_to_kbit (gw_bandwidth, &down, &up); return sprintf(buff, "%i%s/%i%s\n", (down > 2048 ? down / 1024 : down), (down > 2048 ? "MBit" : "KBit"),
@@ -425,7 +425,7 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr,if (buff[count -1 ] =='\n' ) buff[count -1 ] ='\0' ; -return gw_bandwidth_set (net_dev, buff, count); +return batadv_gw_bandwidth_set (net_dev, buff, count); }BAT_ATTR_SIF_BOOL (aggregated_ogms,S_IRUGO |S_IWUSR ,NULL );
@@ -433,7 +433,7 @@ BAT_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);#ifdef CONFIG_BATMAN_ADV_BLA BAT_ATTR_SIF_BOOL (bridge_loop_avoidance,S_IRUGO |S_IWUSR ,NULL );#endif -BAT_ATTR_SIF_BOOL (fragmentation,S_IRUGO |S_IWUSR , update_min_mtu); +BAT_ATTR_SIF_BOOL (fragmentation,S_IRUGO |S_IWUSR , batadv_update_min_mtu);BAT_ATTR_SIF_BOOL (ap_isolation,S_IRUGO |S_IWUSR ,NULL ); static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); static BAT_ATTR(routing_algo, S_IRUGO, show_bat_algo, NULL);
@@ -469,7 +469,7 @@ static struct bat_attribute *mesh_attrs[] = { NULL, }; -int sysfs_add_meshif (struct net_device *dev) +int batadv_sysfs_add_meshif (struct net_device *dev) {struct kobject *batif_kobject = &dev->dev.kobj;struct bat_priv *bat_priv =netdev_priv (dev);
@@ -507,7 +507,7 @@ out:return -ENOMEM ; } -void sysfs_del_meshif (struct net_device *dev) +void batadv_sysfs_del_meshif (struct net_device *dev) {struct bat_priv *bat_priv =netdev_priv (dev);struct bat_attribute **bat_attr;
@@ -523,7 +523,7 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr, char *buff) {struct net_device *net_dev =kobj_to_netdev (kobj); -struct hard_iface *hard_iface =hardif_get_by_netdev (net_dev); +struct hard_iface *hard_iface =batadv_hardif_get_by_netdev (net_dev);ssize_t length;if (!hard_iface)
@@ -541,7 +541,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, char *buff, size_t count) {struct net_device *net_dev =kobj_to_netdev (kobj); -struct hard_iface *hard_iface =hardif_get_by_netdev (net_dev); +struct hard_iface *hard_iface =batadv_hardif_get_by_netdev (net_dev);int status_tmp =-1 ;int ret = count;
@@ -576,15 +576,15 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr, }if (status_tmp ==IF_NOT_IN_USE ) { -hardif_disable_interface (hard_iface); +batadv_hardif_disable_interface (hard_iface); goto unlock; }/* if the interface already is in use */ if (hard_iface->if_status !=IF_NOT_IN_USE ) -hardif_disable_interface (hard_iface); +batadv_hardif_disable_interface (hard_iface); - ret =hardif_enable_interface (hard_iface, buff); + ret =batadv_hardif_enable_interface (hard_iface, buff); unlock:rtnl_unlock ();
@@ -597,7 +597,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr, char *buff) {struct net_device *net_dev =kobj_to_netdev (kobj); -struct hard_iface *hard_iface =hardif_get_by_netdev (net_dev); +struct hard_iface *hard_iface =batadv_hardif_get_by_netdev (net_dev);ssize_t length;if (!hard_iface)
@@ -637,7 +637,7 @@ static struct bat_attribute *batman_attrs[] = { NULL, }; -int sysfs_add_hardif (struct kobject **hardif_obj,struct net_device *dev) +int batadv_sysfs_add_hardif (struct kobject **hardif_obj,struct net_device *dev) {struct kobject *hardif_kobject = &dev->dev.kobj;struct bat_attribute **bat_attr;
@@ -671,14 +671,14 @@ out:return -ENOMEM ; } -void sysfs_del_hardif (struct kobject **hardif_obj) +void batadv_sysfs_del_hardif (struct kobject **hardif_obj) {kobject_put (*hardif_obj); *hardif_obj =NULL ; } -int throw_uevent (struct bat_priv *bat_priv,enum uev_type type, -enum uev_action action,const char *data) +int batadv_throw_uevent (struct bat_priv *bat_priv,enum uev_type type, +enum uev_action action,const char *data) {int ret = -ENOMEM ;struct hard_iface *primary_if =NULL ;
bat_sysfs.h +7 -6
@@ -34,11 +34,12 @@ struct bat_attribute { char *buf, size_t count); }; -int sysfs_add_meshif (struct net_device *dev); -void sysfs_del_meshif (struct net_device *dev); -int sysfs_add_hardif (struct kobject **hardif_obj,struct net_device *dev); -void sysfs_del_hardif (struct kobject **hardif_obj); -int throw_uevent (struct bat_priv *bat_priv,enum uev_type type, -enum uev_action action,const char *data); +int batadv_sysfs_add_meshif (struct net_device *dev); +void batadv_sysfs_del_meshif (struct net_device *dev); +int batadv_sysfs_add_hardif (struct kobject **hardif_obj, +struct net_device *dev); +void batadv_sysfs_del_hardif (struct kobject **hardif_obj); +int batadv_throw_uevent (struct bat_priv *bat_priv,enum uev_type type, +enum uev_action action,const char *data);#endif /* _NET_BATMAN_ADV_SYSFS_H_ */
bitarray.c +4 -4
@@ -25,7 +25,7 @@#include <linux/bitops.h> /* shift the packet array by n places. */ -static void bat_bitmap_shift_left (unsigned long *seq_bits,int32_t n) +static void batadv_bitmap_shift_left (unsigned long *seq_bits,int32_t n) {if (n <=0 || n >=TQ_LOCAL_WINDOW_SIZE )return ;
@@ -40,8 +40,8 @@ static void bat_bitmap_shift_left(unsigned long *seq_bits, int32_t n)* 1 if the window was moved (either new or very old) * 0 if the window was not moved/shifted. */ -int bit_get_packet (void *priv,unsigned long *seq_bits, -int32_t seq_num_diff,int set_mark) +int batadv_bit_get_packet (void *priv,unsigned long *seq_bits, +int32_t seq_num_diff,int set_mark) {struct bat_priv *bat_priv = priv;
@@ -58,7 +58,7 @@ int bit_get_packet(void *priv, unsigned long *seq_bits,* set the mark if required */ if ((seq_num_diff >0 ) && (seq_num_diff <TQ_LOCAL_WINDOW_SIZE )) { -bat_bitmap_shift_left (seq_bits, seq_num_diff); +batadv_bitmap_shift_left (seq_bits, seq_num_diff);if (set_mark)bat_set_bit (seq_bits,0 );
bitarray.h +2 -2
@@ -48,7 +48,7 @@ static inline void bat_set_bit(unsigned long *seq_bits, int32_t n)/* receive and process one packet, returns 1 if received seq_num is considered * new, 0 if old */ -int bit_get_packet (void *priv,unsigned long *seq_bits, -int32_t seq_num_diff,int set_mark); +int batadv_bit_get_packet (void *priv,unsigned long *seq_bits, +int32_t seq_num_diff,int set_mark);#endif /* _NET_BATMAN_ADV_BITARRAY_H_ */
bridge_loop_avoidance.c +23 -23
134 lines not on this page · raw message
bridge_loop_avoidance.h +34 -31
107 lines not on this page · raw message
compat.c +4 -4
@@ -28,7 +28,7 @@#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,0 ,0 ) -void free_rcu_gw_node (struct rcu_head *rcu) +void batadv_free_rcu_gw_node (struct rcu_head *rcu) {struct gw_node *gw_node;
@@ -36,7 +36,7 @@ void free_rcu_gw_node(struct rcu_head *rcu)kfree (gw_node); } -void free_rcu_neigh_node (struct rcu_head *rcu) +void batadv_free_rcu_neigh_node (struct rcu_head *rcu) {struct neigh_node *neigh_node;
@@ -44,7 +44,7 @@ void free_rcu_neigh_node(struct rcu_head *rcu)kfree (neigh_node); } -void free_rcu_tt_local_entry (struct rcu_head *rcu) +void batadv_free_rcu_tt_local_entry (struct rcu_head *rcu) {struct tt_common_entry *tt_common_entry;struct tt_local_entry *tt_local_entry;
@@ -56,7 +56,7 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu) }#ifdef CONFIG_BATMAN_ADV_BLA -void free_rcu_backbone_gw (struct rcu_head *rcu) +void batadv_free_rcu_backbone_gw (struct rcu_head *rcu) {struct backbone_gw *backbone_gw;
compat.h +1 -1
@@ -138,7 +138,7 @@ static inline int __param_set_copystring(const char *val,#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,0 ,0 ) -#define kfree_rcu (ptr, rcu_head) call_rcu(&ptr->rcu_head, free_rcu_##ptr) +#define kfree_rcu (ptr, rcu_head) call_rcu(&ptr->rcu_head, batadv_free_rcu_##ptr)#define vlan_insert_tag (skb, vid) __vlan_put_tag(skb, vid)void free_rcu_gw_node (struct rcu_head *rcu);
distributed-arp-table.c +25 -21
116 lines not on this page · raw message
distributed-arp-table.h +36 -31
116 lines not on this page · raw message
gateway_client.c +49 -44
284 lines not on this page · raw message
gateway_client.h +14 -12
@@ -22,17 +22,19 @@#ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_#define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ -void gw_deselect (struct bat_priv *bat_priv); -void gw_election (struct bat_priv *bat_priv); -struct orig_node *gw_get_selected_orig (struct bat_priv *bat_priv); -void gw_check_election (struct bat_priv *bat_priv,struct orig_node *orig_node); -void gw_node_update (struct bat_priv *bat_priv, -struct orig_node *orig_node,uint8_t new_gwflags); -void gw_node_delete (struct bat_priv *bat_priv,struct orig_node *orig_node); -void gw_node_purge (struct bat_priv *bat_priv); -int gw_client_seq_print_text (struct seq_file *seq,void *offset); -bool gw_is_dhcp_target (struct sk_buff *skb,unsigned int *header_len); -bool gw_out_of_range (struct bat_priv *bat_priv, -struct sk_buff *skb,struct ethhdr *ethhdr); +void batadv_gw_deselect (struct bat_priv *bat_priv); +void batadv_gw_election (struct bat_priv *bat_priv); +struct orig_node *batadv_gw_get_selected_orig (struct bat_priv *bat_priv); +void batadv_gw_check_election (struct bat_priv *bat_priv, +struct orig_node *orig_node); +void batadv_gw_node_update (struct bat_priv *bat_priv, +struct orig_node *orig_node,uint8_t new_gwflags); +void batadv_gw_node_delete (struct bat_priv *bat_priv, +struct orig_node *orig_node); +void batadv_gw_node_purge (struct bat_priv *bat_priv); +int batadv_gw_client_seq_print_text (struct seq_file *seq,void *offset); +bool batadv_gw_is_dhcp_target (struct sk_buff *skb,unsigned int *header_len); +bool batadv_gw_out_of_range (struct bat_priv *bat_priv, +struct sk_buff *skb,struct ethhdr *ethhdr);#endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
gateway_common.c +5 -4
@@ -59,7 +59,7 @@ static void kbit_to_gw_bandwidth(int down, int up, long *gw_srv_class) }/* returns the up and downspeeds in kbit, calculated from the class */ -void gw_bandwidth_to_kbit (uint8_t gw_srv_class,int *down,int *up) +void batadv_gw_bandwidth_to_kbit (uint8_t gw_srv_class,int *down,int *up) {int sbit = (gw_srv_class &0x80 ) >>7 ;int dpart = (gw_srv_class &0x78 ) >>3 ;
@@ -136,7 +136,8 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff,return true; } -ssize_t gw_bandwidth_set (struct net_device *net_dev,char *buff,size_t count) +ssize_t batadv_gw_bandwidth_set (struct net_device *net_dev,char *buff, +size_t count) {struct bat_priv *bat_priv =netdev_priv (net_dev);long gw_bandwidth_tmp =0 ;
@@ -160,9 +161,9 @@ ssize_t gw_bandwidth_set(struct net_device *net_dev, char *buff, size_t count)* speeds, hence we need to calculate it back to show the number * that is going to be propagated **/ -gw_bandwidth_to_kbit ((uint8_t )gw_bandwidth_tmp, &down, &up); +batadv_gw_bandwidth_to_kbit ((uint8_t )gw_bandwidth_tmp, &down, &up); -gw_deselect (bat_priv); +batadv_gw_deselect (bat_priv); bat_info(net_dev, "Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n", atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp,
gateway_common.h +3 -2
@@ -32,7 +32,8 @@ enum gw_modes {#define GW_MODE_CLIENT_NAME "client"#define GW_MODE_SERVER_NAME "server" -void gw_bandwidth_to_kbit (uint8_t gw_class,int *down,int *up); -ssize_t gw_bandwidth_set (struct net_device *net_dev,char *buff,size_t count); +void batadv_gw_bandwidth_to_kbit (uint8_t gw_class,int *down,int *up); +ssize_t batadv_gw_bandwidth_set (struct net_device *net_dev,char *buff, +size_t count);#endif /* _NET_BATMAN_ADV_GATEWAY_COMMON_H_ */
hard-interface.c +36 -36
255 lines not on this page · raw message
hard-interface.h +11 -11
@@ -31,23 +31,23 @@ enum hard_if_state {IF_I_WANT_YOU }; -extern struct notifier_block hard_if_notifier; +extern struct notifier_block batadv_hard_if_notifier;struct hard_iface * -hardif_get_by_netdev (const struct net_device *net_dev); -int hardif_enable_interface (struct hard_iface *hard_iface, -const char *iface_name); -void hardif_disable_interface (struct hard_iface *hard_iface); -void hardif_remove_interfaces (void ); -int hardif_min_mtu (struct net_device *soft_iface); -void update_min_mtu (struct net_device *soft_iface); -void hardif_free_rcu (struct rcu_head *rcu); -bool is_wifi_iface (int ifindex); +batadv_hardif_get_by_netdev (const struct net_device *net_dev); +int batadv_hardif_enable_interface (struct hard_iface *hard_iface, +const char *iface_name); +void batadv_hardif_disable_interface (struct hard_iface *hard_iface); +void batadv_hardif_remove_interfaces (void ); +int batadv_hardif_min_mtu (struct net_device *soft_iface); +void batadv_update_min_mtu (struct net_device *soft_iface); +void batadv_hardif_free_rcu (struct rcu_head *rcu); +bool batadv_is_wifi_iface (int ifindex);static inline void hardif_free_ref (struct hard_iface *hard_iface) {if (atomic_dec_and_test (&hard_iface->refcount)) -call_rcu (&hard_iface->rcu, hardif_free_rcu); +call_rcu (&hard_iface->rcu, batadv_hardif_free_rcu); } static inline struct hard_iface *primary_if_get_selected(
hash.c +2 -2
@@ -34,7 +34,7 @@ static void hash_init(struct hashtable_t *hash) }/* free only the hashtable and the hash itself. */ -void hash_destroy (struct hashtable_t *hash) +void batadv_hash_destroy (struct hashtable_t *hash) {kfree (hash->list_locks);kfree (hash->table);
@@ -42,7 +42,7 @@ void hash_destroy(struct hashtable_t *hash) }/* allocates and clears the hash */ -struct hashtable_t *hash_new (uint32_t size) +struct hashtable_t *batadv_hash_new (uint32_t size) {struct hashtable_t *hash;
hash.h +3 -3
@@ -43,13 +43,13 @@ struct hashtable_t { };/* allocates and clears the hash */ -struct hashtable_t *hash_new (uint32_t size); +struct hashtable_t *batadv_hash_new (uint32_t size);/* set class key for all locks */ void hash_set_lock_class (struct hashtable_t *hash,struct lock_class_key *key);/* free only the hashtable and the hash itself. */ -void hash_destroy (struct hashtable_t *hash); +void batadv_hash_destroy (struct hashtable_t *hash);/* remove the hash structure. if hashdata_free_cb != NULL, this function will be * called to remove the elements inside of the hash. if you don't remove the
@@ -76,7 +76,7 @@ static inline void hash_delete(struct hashtable_t *hash,spin_unlock_bh (list_lock); } -hash_destroy (hash); +batadv_hash_destroy (hash); }/**
icmp_socket.c +10 -10
@@ -34,7 +34,7 @@ static void bat_socket_add_packet(struct socket_client *socket_client,struct icmp_packet_rr *icmp_packet, size_t icmp_len); -void bat_socket_init (void ) +void batadv_socket_init (void ) {memset (socket_client_hash,0 ,sizeof (socket_client_hash)); }
@@ -73,7 +73,7 @@ static int bat_socket_open(struct inode *inode, struct file *file) file->private_data = socket_client; -inc_module_count (); +batadv_inc_module_count ();return 0 ; }
@@ -98,7 +98,7 @@ static int bat_socket_release(struct inode *inode, struct file *file)spin_unlock_bh (&socket_client->lock);kfree (socket_client); -dec_module_count (); +batadv_dec_module_count ();return 0 ; }
@@ -219,7 +219,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,if (!orig_node) goto dst_unreach; - neigh_node =orig_node_get_router (orig_node); + neigh_node =batadv_orig_node_get_router (orig_node);if (!neigh_node) goto dst_unreach;
@@ -236,7 +236,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,memcpy (icmp_packet->rr, neigh_node->if_incoming->net_dev->dev_addr,ETH_ALEN ); -send_skb_packet (skb, neigh_node->if_incoming, neigh_node->addr); +batadv_send_skb_packet (skb, neigh_node->if_incoming, neigh_node->addr); goto out; dst_unreach:
@@ -248,9 +248,9 @@ out:if (primary_if)hardif_free_ref (primary_if);if (neigh_node) -neigh_node_free_ref (neigh_node); +batadv_neigh_node_free_ref (neigh_node);if (orig_node) -orig_node_free_ref (orig_node); +batadv_orig_node_free_ref (orig_node);return len; }
@@ -276,7 +276,7 @@ static const struct file_operations fops = { .llseek = no_llseek, }; -int bat_socket_setup (struct bat_priv *bat_priv) +int batadv_socket_setup (struct bat_priv *bat_priv) {struct dentry *d;
@@ -336,8 +336,8 @@ 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_rr *icmp_packet, -size_t icmp_len) +void batadv_socket_receive_packet (struct icmp_packet_rr *icmp_packet, +size_t icmp_len) {struct socket_client *hash = socket_client_hash[icmp_packet->uid];
icmp_socket.h +4 -4
@@ -24,9 +24,9 @@#define ICMP_SOCKET "socket" -void bat_socket_init (void ); -int bat_socket_setup (struct bat_priv *bat_priv); -void bat_socket_receive_packet (struct icmp_packet_rr *icmp_packet, -size_t icmp_len); +void batadv_socket_init (void ); +int batadv_socket_setup (struct bat_priv *bat_priv); +void batadv_socket_receive_packet (struct icmp_packet_rr *icmp_packet, +size_t icmp_len);#endif /* _NET_BATMAN_ADV_ICMP_SOCKET_H_ */
main.c +55 -54
249 lines not on this page · raw message
main.h +24 -22
58 lines not on this page · raw message
originator.c +34 -31
208 lines not on this page · raw message
originator.h +11 -10
@@ -24,19 +24,20 @@#include "hash.h" -int originator_init (struct bat_priv *bat_priv); -void originator_free (struct bat_priv *bat_priv); -void purge_orig_ref (struct bat_priv *bat_priv); -void orig_node_free_ref (struct orig_node *orig_node); -struct orig_node *get_orig_node (struct bat_priv *bat_priv,const uint8_t *addr); +int batadv_originator_init (struct bat_priv *bat_priv); +void batadv_originator_free (struct bat_priv *bat_priv); +void batadv_purge_orig_ref (struct bat_priv *bat_priv); +void batadv_orig_node_free_ref (struct orig_node *orig_node); +struct orig_node *batadv_get_orig_node (struct bat_priv *bat_priv, +const uint8_t *addr);struct neigh_node *batadv_neigh_node_new (struct hard_iface *hard_iface,const uint8_t *neigh_addr,uint32_t seqno); -void neigh_node_free_ref (struct neigh_node *neigh_node); -struct neigh_node *orig_node_get_router (struct orig_node *orig_node); -int orig_seq_print_text (struct seq_file *seq,void *offset); -int orig_hash_add_if (struct hard_iface *hard_iface,int max_if_num); -int orig_hash_del_if (struct hard_iface *hard_iface,int max_if_num); +void batadv_neigh_node_free_ref (struct neigh_node *neigh_node); +struct neigh_node *batadv_orig_node_get_router (struct orig_node *orig_node); +int batadv_orig_seq_print_text (struct seq_file *seq,void *offset); +int batadv_orig_hash_add_if (struct hard_iface *hard_iface,int max_if_num); +int batadv_orig_hash_del_if (struct hard_iface *hard_iface,int max_if_num);/* hashfunction to choose an entry in a hash table of given size */
ring_buffer.c +3 -2
@@ -22,13 +22,14 @@#include "main.h" #include "ring_buffer.h" -void ring_buffer_set (uint8_t lq_recv[],uint8_t *lq_index,uint8_t value) +void batadv_ring_buffer_set (uint8_t lq_recv[],uint8_t *lq_index, +uint8_t value) { lq_recv[*lq_index] = value; *lq_index = (*lq_index +1 ) %TQ_GLOBAL_WINDOW_SIZE ; } -uint8_t ring_buffer_avg (const uint8_t lq_recv[]) +uint8_t batadv_ring_buffer_avg (const uint8_t lq_recv[]) {const uint8_t *ptr;uint16_t count =0 , i =0 , sum =0 ;
ring_buffer.h +3 -2
@@ -22,7 +22,8 @@#ifndef _NET_BATMAN_ADV_RING_BUFFER_H_#define _NET_BATMAN_ADV_RING_BUFFER_H_ -void ring_buffer_set (uint8_t lq_recv[],uint8_t *lq_index,uint8_t value); -uint8_t ring_buffer_avg (const uint8_t lq_recv[]); +void batadv_ring_buffer_set (uint8_t lq_recv[],uint8_t *lq_index, +uint8_t value); +uint8_t batadv_ring_buffer_avg (const uint8_t lq_recv[]);#endif /* _NET_BATMAN_ADV_RING_BUFFER_H_ */
routing.c +111 -104
478 lines not on this page · raw message
routing.h +27 -25
52 lines not on this page · raw message
send.c +26 -21
47 lines not on this page · raw message
soft-interface.c +34 -34
68 lines not on this page · raw message
translation-table.c +78 -72
150 lines not on this page · raw message
translation-table.h +39 -32
71 lines not on this page · raw message
unicast.c +32 -30
62 lines not on this page · raw message
vis.c +29 -28
57 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.10
Part of the diff is not shown here. View the raw message.
PATCH v2 2/3 batman-adv: Fix namespace for hash_set_lock_class
This function was introduced in 2c9aa3b4c37bd55148f5f25212c89e7bf5f28497 without a proper namespace prefix.
--- bridge_loop_avoidance.c | 7 ++++--- hash.c | 3 ++- hash.h | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-)
bridge_loop_avoidance.c +4 -3
@@ -1172,9 +1172,10 @@ int batadv_bla_init(struct bat_priv *bat_priv)if (!bat_priv->claim_hash || !bat_priv->backbone_hash)return -ENOMEM ; -hash_set_lock_class (bat_priv->claim_hash, &claim_hash_lock_class_key); -hash_set_lock_class (bat_priv->backbone_hash, - &backbone_hash_lock_class_key); +batadv_hash_set_lock_class (bat_priv->claim_hash, + &claim_hash_lock_class_key); +batadv_hash_set_lock_class (bat_priv->backbone_hash, + &backbone_hash_lock_class_key);bat_dbg (DBG_BLA , bat_priv,"bla hashes initialized\n" );
hash.c +2 -1
@@ -70,7 +70,8 @@ free_hash:return NULL ; } -void hash_set_lock_class (struct hashtable_t *hash,struct lock_class_key *key) +void batadv_hash_set_lock_class (struct hashtable_t *hash, +struct lock_class_key *key) {uint32_t i;
hash.h +2 -1
@@ -46,7 +46,8 @@ struct hashtable_t {struct hashtable_t *batadv_hash_new (uint32_t size);/* set class key for all locks */ -void hash_set_lock_class (struct hashtable_t *hash,struct lock_class_key *key); +void batadv_hash_set_lock_class (struct hashtable_t *hash, +struct lock_class_key *key);/* free only the hashtable and the hash itself. */ void batadv_hash_destroy (struct hashtable_t *hash);
Signature · 1 line
1.7.10
PATCH v2 3/3 batman-adv: Reformat multiline to consistent style
In reply to Sven Eckelmannbatman-adv doesn't follow the style for multiline comments that David S. Miller prefers. All comments should be reformatted to follow this consistent style to make the code slightly more readable.
--- bat_algo.h | 4 +-- bat_debugfs.c | 4 +-- bat_debugfs.h | 5 +-- bat_iv_ogm.c | 75 ++++++++++++++++++++++----------------- bat_sysfs.c | 13 +++---- bat_sysfs.h | 5 +-- bitarray.c | 17 ++++----- bitarray.h | 10 +++--- bridge_loop_avoidance.c | 67 ++++++++++------------------------- bridge_loop_avoidance.h | 4 +-- compat.c | 3 +- compat.h | 3 +- distributed-arp-table.c | 10 +++--- distributed-arp-table.h | 4 +-- gateway_client.c | 41 ++++++++++----------- gateway_client.h | 4 +-- gateway_common.c | 9 ++--- gateway_common.h | 4 +-- hard-interface.c | 23 +++++------- hard-interface.h | 4 +-- hash.c | 4 +-- hash.h | 24 ++++++------- icmp_socket.c | 7 ++-- icmp_socket.h | 4 +-- main.c | 10 +++--- main.h | 38 ++++++++++---------- originator.c | 13 +++---- originator.h | 9 +++-- packet.h | 21 ++++++----- ring_buffer.c | 4 +-- ring_buffer.h | 4 +-- routing.c | 70 +++++++++++++++++++++--------------- routing.h | 4 +-- send.c | 35 ++++++++---------- send.h | 4 +-- soft-interface.c | 27 +++++++------- soft-interface.h | 4 +-- translation-table.c | 90 +++++++++++++++++++++++++++++------------------ translation-table.h | 4 +-- types.h | 29 +++++++-------- unicast.c | 13 ++++--- unicast.h | 4 +-- vis.c | 39 ++++++++++++-------- vis.h | 8 ++--- 44 files changed, 370 insertions(+), 408 deletions(-)
bat_algo.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_BAT_ALGO_H_
bat_debugfs.c +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
bat_debugfs.h +1 -4
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,10 +15,8 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ -#ifndef _NET_BATMAN_ADV_DEBUGFS_H_#define _NET_BATMAN_ADV_DEBUGFS_H_
bat_iv_ogm.c +42 -33
217 lines not on this page · raw message
bat_sysfs.c +7 -6
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -84,7 +82,8 @@ ssize_t show_##_name(struct kobject *kobj, \ } \/* Use this, if you are going to turn a [name] in the soft-interface -* (bat_priv) on or off */ +* (bat_priv) on or off +*/ #define BAT_ATTR_SIF_BOOL (_name, _mode, _post_func) \ static BAT_ATTR_SIF_STORE_BOOL(_name, _post_func) \ static BAT_ATTR_SIF_SHOW_BOOL(_name) \
@@ -110,7 +109,8 @@ ssize_t show_##_name(struct kobject *kobj, \ } \/* Use this, if you are going to set [name] in the soft-interface -* (bat_priv) to an unsigned integer value */ +* (bat_priv) to an unsigned integer value +*/ #define BAT_ATTR_SIF_UINT (_name, _mode, _min, _max, _post_func) \ static BAT_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func) \ static BAT_ATTR_SIF_SHOW_UINT(_name) \
@@ -153,7 +153,8 @@ ssize_t show_##_name(struct kobject *kobj, \ }/* Use this, if you are going to set [name] in hard_iface to an -* unsigned integer value*/ +* unsigned integer value +*/ #define BAT_ATTR_HIF_UINT (_name, _mode, _min, _max, _post_func) \ static BAT_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ static BAT_ATTR_HIF_SHOW_UINT(_name) \
bat_sysfs.h +1 -4
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,10 +15,8 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ -#ifndef _NET_BATMAN_ADV_SYSFS_H_#define _NET_BATMAN_ADV_SYSFS_H_
bitarray.c +7 -10
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: * * Simon Wunderlich, Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -46,8 +44,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,struct bat_priv *bat_priv = priv;/* sequence number is slightly older. We already got a sequence number -* higher than this one, so we just mark it. */ - +* higher than this one, so we just mark it. +*/ if ((seq_num_diff <=0 ) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE )) {if (set_mark)bat_set_bit (seq_bits, -seq_num_diff);
@@ -55,8 +53,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, }/* sequence number is slightly newer, so we shift the window and -* set the mark if required */ - +* set the mark if required +*/ if ((seq_num_diff >0 ) && (seq_num_diff <TQ_LOCAL_WINDOW_SIZE )) {batadv_bitmap_shift_left (seq_bits, seq_num_diff);
@@ -66,7 +64,6 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, }/* sequence number is much newer, probably missed a lot of packets */ -if ((seq_num_diff >=TQ_LOCAL_WINDOW_SIZE ) && (seq_num_diff <EXPECTED_SEQNO_RANGE )) { bat_dbg(DBG_BATMAN, bat_priv,
@@ -81,8 +78,8 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,/* received a much older packet. The other host either restarted * or the old packet got delayed somewhere in the network. The * packet should be dropped without calling this function if the -* seqno window is protected. */ - +* seqno window is protected. +*/ if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE ) || (seq_num_diff >=EXPECTED_SEQNO_RANGE )) {
bitarray.h +5 -5
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: * * Simon Wunderlich, Marek Lindner *
@@ -16,14 +15,14 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_BITARRAY_H_#define _NET_BATMAN_ADV_BITARRAY_H_/* returns true if the corresponding bit in the given seq_bits indicates true -* and curr_seqno is within range of last_seqno */ +* and curr_seqno is within range of last_seqno +*/ static inline int bat_test_bit (const unsigned long *seq_bits,uint32_t last_seqno,uint32_t curr_seqno) {
@@ -47,7 +46,8 @@ static inline void bat_set_bit(unsigned long *seq_bits, int32_t n) }/* receive and process one packet, returns 1 if received seq_num is considered -* new, 0 if old */ +* new, 0 if old +*/ int batadv_bit_get_packet (void *priv,unsigned long *seq_bits,int32_t seq_num_diff,int set_mark);
bridge_loop_avoidance.c +19 -48
224 lines not on this page · raw message
bridge_loop_avoidance.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: * * Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_BLA_H_
compat.c +1 -2
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
compat.h +1 -2
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
distributed-arp-table.c +5 -5
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: * * Antonio Quartulli *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include <linux/if_ether.h>
@@ -336,7 +334,8 @@ static uint16_t arp_get_type(struct bat_priv *bat_priv, struct sk_buff *skb, arphdr = (struct arphdr *)(skb->data + hdr_size +ETH_HLEN );/* Check whether the ARP packet carries a valid -* IP information */ +* IP information +*/ if (arphdr->ar_hrd !=htons (ARPHRD_ETHER )) goto out;
@@ -350,7 +349,8 @@ static uint16_t arp_get_type(struct bat_priv *bat_priv, struct sk_buff *skb, goto out;/* Check for bad reply/request. If the ARP message is not sane, DAT -* will simply ignore it */ +* will simply ignore it +*/ ip_src =ARP_IP_SRC (skb, hdr_size); ip_dst =ARP_IP_DST (skb, hdr_size); if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) ||
distributed-arp-table.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2011-2012 B.A.T.M.A.N. contributors: * * Antonio Quartulli *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_ARP_H_
gateway_client.c +19 -22
117 lines not on this page · raw message
gateway_client.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
gateway_common.c +3 -6
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -156,11 +154,10 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,kbit_to_gw_bandwidth (down, up, &gw_bandwidth_tmp); -/** -* the gw bandwidth we guessed above might not match the given +/* the gw bandwidth we guessed above might not match the given * speeds, hence we need to calculate it back to show the number * that is going to be propagated -**/ +*/ batadv_gw_bandwidth_to_kbit ((uint8_t )gw_bandwidth_tmp, &down, &up);batadv_gw_deselect (bat_priv);
gateway_common.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_GATEWAY_COMMON_H_
hard-interface.c +9 -14
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -75,10 +73,6 @@ static int is_valid_iface(const struct net_device *net_dev)if (batadv_softif_is_valid (net_dev))return 0 ; -/* Device is being bridged */ -/* if (net_dev->priv_flags & IFF_BRIDGE_PORT) -return 0; */ -return 1 ; }
@@ -188,7 +182,8 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)const struct bat_priv *bat_priv =netdev_priv (soft_iface);const struct hard_iface *hard_iface;/* allow big frames if all devices are capable to do so -* (have MTU > 1500 + BAT_HEADER_LEN) */ +* (have MTU > 1500 + BAT_HEADER_LEN) +*/ int min_mtu =ETH_DATA_LEN ;if (atomic_read (&bat_priv->fragmentation))
@@ -234,8 +229,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface) bat_priv->bat_algo_ops->bat_iface_update_mac (hard_iface); hard_iface->if_status =IF_TO_BE_ACTIVATED ; -/** -* the first active interface becomes our primary interface or +/* the first active interface becomes our primary interface or * the next active interface after the old primary interface was removed */ primary_if =primary_if_get_selected (bat_priv);
@@ -441,8 +435,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev)check_known_mac_addr (hard_iface->net_dev);list_add_tail_rcu (&hard_iface->list, &batadv_hardif_list); -/** -* This can't be called via a bat_priv callback because +/* This can't be called via a bat_priv callback because * we have no bat_priv yet. */ atomic_set (&hard_iface->seqno,1 );
@@ -547,7 +540,8 @@ out: }/* This function returns true if the interface represented by ifindex is a -* 802.11 wireless device */ +* 802.11 wireless device +*/ bool batadv_is_wifi_iface (int ifindex) {struct net_device *net_device =NULL ;
@@ -562,7 +556,8 @@ bool batadv_is_wifi_iface(int ifindex)#ifdef CONFIG_WIRELESS_EXT /* pre-cfg80211 drivers have to implement WEXT, so it is possible to -* check for wireless_handlers != NULL */ +* check for wireless_handlers != NULL +*/ if (net_device->wireless_handlers) ret = true;else
hard-interface.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_
hash.c +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: * * Simon Wunderlich, Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
hash.h +11 -13
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2006-2012 B.A.T.M.A.N. contributors: * * Simon Wunderlich, Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_HASH_H_
@@ -24,15 +22,15 @@#include <linux/list.h> -/* callback to a compare function. should -* compare 2 element datas for their keys, -* return 0 if same and not 0 if not -* same */ +/* callback to a compare function. should compare 2 element datas for their +* keys, return 0 if same and not 0 if not same +*/ typedef int (*hashdata_compare_cb )(const struct hlist_node *,const void *);/* the hashfunction, should return an index * based on the key in the data of the first -* argument and the size the second */ +* argument and the size the second +*/ typedef uint32_t (*hashdata_choose_cb )(const void *,uint32_t );typedef void (*hashdata_free_cb )(struct hlist_node *,void *);
@@ -54,7 +52,8 @@ void batadv_hash_destroy(struct hashtable_t *hash);/* remove the hash structure. if hashdata_free_cb != NULL, this function will be * called to remove the elements inside of the hash. if you don't remove the -* elements, memory might be leaked. */ +* elements, memory might be leaked. +*/ static inline void hash_delete (struct hashtable_t *hash,hashdata_free_cb free_cb,void *arg) {
@@ -80,8 +79,7 @@ static inline void hash_delete(struct hashtable_t *hash,batadv_hash_destroy (hash); } -/** -* hash_add - adds data to the hashtable +/* hash_add - adds data to the hashtable * @hash: storage hash table * @compare: callback to determine if 2 hash elements are identical * @choose: callback calculating the hash index
@@ -91,7 +89,6 @@ static inline void hash_delete(struct hashtable_t *hash,* Returns 0 on success, 1 if the element already is in the hash * and -1 on error. */ - static inline int hash_add(struct hashtable_t *hash, hashdata_compare_cb compare, hashdata_choose_cb choose,
@@ -137,7 +134,8 @@ out:/* removes data from hash, if found. returns pointer do data on success, so you * can remove the used structure yourself, or NULL on error . data could be the * structure you use with just the key filled, we just need the key for -* comparing. */ +* comparing. +*/ static inline void *hash_remove (struct hashtable_t *hash,hashdata_compare_cb compare,hashdata_choose_cb choose,void *data)
icmp_socket.c +3 -4
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -312,7 +310,8 @@ static void bat_socket_add_packet(struct socket_client *socket_client,spin_lock_bh (&socket_client->lock);/* while waiting for the lock the socket_client could have been -* deleted */ +* deleted +*/ if (!socket_client_hash[icmp_packet->uid]) {spin_unlock_bh (&socket_client->lock);kfree (socket_packet);
icmp_socket.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_ICMP_SOCKET_H_
main.c +5 -5
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -37,7 +35,8 @@/* List manipulations on hardif_list have to be rtnl_lock()'ed, -* list traversals just rcu-locked */ +* list traversals just rcu-locked +*/ struct list_head batadv_hardif_list;static int (*recv_packet_handler[256 ])(struct sk_buff *,struct hard_iface *);char batadv_routing_algo[20 ] ="BATMAN_IV" ;
@@ -59,7 +58,8 @@ static int __init batman_init(void)batadv_iv_init ();/* the name should not be longer than 10 chars - see -* http://lwn.net/Articles/23634/ */ +* http://lwn.net/Articles/23634/ +*/ batadv_event_workqueue =create_singlethread_workqueue ("bat_events" );if (!batadv_event_workqueue)
main.h +20 -18
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_MAIN_H_
@@ -36,19 +34,21 @@#define TQ_MAX_VALUE 255#define JITTER 20 -/* Time To Live of broadcast messages */ +/* Time To Live of broadcast messages */ #define TTL 50/* purge originators after time in seconds if no valid packet comes in -* -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */ +* -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE +*/ #define PURGE_TIMEOUT 200000/* 200 seconds */ #define TT_LOCAL_TIMEOUT 3600000/* in miliseconds */ #define TT_CLIENT_ROAM_TIMEOUT 600000/* in miliseconds */ /* sliding packet range of received originator messages in sequence numbers -* (should be a multiple of our word size) */ +* (should be a multiple of our word size) +*/ #define TQ_LOCAL_WINDOW_SIZE 64 -#define TT_REQUEST_TIMEOUT 3000/* miliseconds we have to keep -* pending tt_req */ +/* miliseconds we have to keep pending tt_req */ +#define TT_REQUEST_TIMEOUT 3000#define TQ_GLOBAL_WINDOW_SIZE 5#define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1
@@ -57,8 +57,10 @@#define TT_OGM_APPEND_MAX 3/* number of OGMs sent with the last tt diff */ -#define ROAMING_MAX_TIME 20000/* Time in which a client can roam at most -* ROAMING_MAX_COUNT times in miliseconds*/ +/* Time in which a client can roam at most ROAMING_MAX_COUNT times in +* miliseconds +*/ +#define ROAMING_MAX_TIME 20000#define ROAMING_MAX_COUNT 5#define NO_FLAGS 0
@@ -81,11 +83,13 @@#define VIS_INTERVAL 5000/* 5 seconds */ /* how much worse secondary interfaces may be to be considered as bonding -* candidates */ +* candidates +*/ #define BONDING_TQ_THRESHOLD 50/* should not be bigger than 512 bytes or change the size of -* forw_packet->direct_link_flags */ +* forw_packet->direct_link_flags +*/ #define MAX_AGGREGATION_BYTES 512#define MAX_AGGREGATION_MS 100
@@ -216,19 +220,16 @@ static inline void bat_dbg(int type __always_unused, pr_err("%s: " fmt, _netdev->name, ## arg); \ } while (0) -/** -* returns 1 if they are the same ethernet addr +/* returns 1 if they are the same ethernet addr * * note: can't use compare_ether_addr() as it requires aligned memory */ -static inline int compare_eth (const void *data1,const void *data2) {return (memcmp (data1, data2,ETH_ALEN ) ==0 ?1 :0 ); } -/** -* has_timed_out - compares current time (jiffies) and timestamp + timeout +/* has_timed_out - compares current time (jiffies) and timestamp + timeout * @timestamp: base value to compare with (in jiffies) * @timeout: added to base value before comparing (in milliseconds) *
@@ -252,7 +253,8 @@ static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout)* - when adding nothing - it is neither a predecessor nor a successor * - before adding more than 127 to the starting value - it is a predecessor, * - when adding 128 - it is neither a predecessor nor a successor, -* - after adding more than 127 to the starting value - it is a successor */ +* - after adding more than 127 to the starting value - it is a successor +*/ #define seq_before (x, y) ({typeof(x) _d1 = (x); \ typeof(y) _d2 = (y); \ typeof(x) _dummy = (_d1 - _d2); \
originator.c +7 -6
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2009-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -189,7 +187,8 @@ void batadv_originator_free(struct bat_priv *bat_priv) }/* this function finds or creates an originator entry for the given -* address if it does not exits */ +* address if it does not exits +*/ struct orig_node *batadv_get_orig_node (struct bat_priv *bat_priv,const uint8_t *addr) {
@@ -523,7 +522,8 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)int ret;/* resize all orig nodes because orig_node->bcast_own(_sum) depend on -* if_num */ +* if_num +*/ for (i =0 ; i < hash->size; i++) { head = &hash->table[i];
@@ -606,7 +606,8 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)int ret;/* resize all orig nodes because orig_node->bcast_own(_sum) depend on -* if_num */ +* if_num +*/ for (i =0 ; i < hash->size; i++) { head = &hash->table[i];
originator.h +4 -5
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_ORIGINATOR_H_
@@ -40,8 +38,9 @@ int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num);int batadv_orig_hash_del_if (struct hard_iface *hard_iface,int max_if_num); -/* hashfunction to choose an entry in a hash table of given size */ -/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ +/* hashfunction to choose an entry in a hash table of given size +* hash algorithm from http://en.wikipedia.org/wiki/Hash_table +*/ static inline uint32_t choose_orig (const void *data,uint32_t size) {const unsigned char *key = data;
packet.h +12 -9
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_PACKET_H_
@@ -89,7 +87,8 @@ enum tt_query_flags {/* TT_CLIENT flags. * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to -* 1 << 15 are used for local computation only */ +* 1 << 15 are used for local computation only +*/ enum tt_client_flags {TT_CLIENT_DEL =1 <<0 ,TT_CLIENT_ROAM =1 <<1 ,
@@ -150,7 +149,8 @@ struct icmp_packet {#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 */ +* as this is assumed by code that handles ICMP packets +*/ struct icmp_packet_rr {struct batman_header header;uint8_t msg_type;/* see ICMP message types above */
@@ -206,7 +206,8 @@ struct tt_query_packet {struct batman_header header;/* the flag field is a combination of: * - TT_REQUEST or TT_RESPONSE -* - TT_FULL_TABLE */ +* - TT_FULL_TABLE +*/ uint8_t flags;uint8_t dst[ETH_ALEN ];uint8_t src[ETH_ALEN ];
@@ -214,13 +215,15 @@ struct tt_query_packet {* if TT_REQUEST: ttvn that triggered the * request * if TT_RESPONSE: new ttvn for the src -* orig_node */ +* orig_node +*/ uint8_t ttvn;/* tt_data field is: * if TT_REQUEST: crc associated with the * ttvn -* if TT_RESPONSE: table_size */ -__be16 tt_data; +* if TT_RESPONSE: table_size +*/ +__be16 tt_data; } __packed;struct roam_adv_packet {
ring_buffer.c +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
ring_buffer.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_RING_BUFFER_H_
routing.c +41 -29
194 lines not on this page · raw message
routing.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_ROUTING_H_
send.c +15 -20
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -33,7 +31,8 @@static void send_outstanding_bcast_packet (struct work_struct *work);/* send out an already prepared packet to the given address via the -* specified batman interface */ +* specified batman interface +*/ int batadv_send_skb_packet (struct sk_buff *skb,struct hard_iface *hard_iface,const uint8_t *dst_addr) {
@@ -70,8 +69,8 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,/* dev_queue_xmit() returns a negative result on error. However on * congestion and traffic shaping, it drops and returns NET_XMIT_DROP -* (which is > 0). This will not be treated as an error. */ - +* (which is > 0). This will not be treated as an error. +*/ return dev_queue_xmit (skb); send_skb_err:kfree_skb (skb);
@@ -109,7 +108,8 @@ static int prepare_packet_buffer(struct bat_priv *bat_priv, new_len =BATMAN_OGM_HLEN +batadv_tt_len (num_changes);/* if we have too many changes for one packet don't send any -* and wait for the tt table request which will be fragmented */ +* and wait for the tt table request which will be fragmented +*/ if (new_len > hard_iface->soft_iface->mtu) new_len =BATMAN_OGM_HLEN ;
@@ -142,8 +142,7 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface) (hard_iface->if_status == IF_TO_BE_REMOVED)) return; -/** -* the interface gets activated here to avoid race conditions between +/* the interface gets activated here to avoid race conditions between * the moment of activating the interface in * hardif_activate_interface() where the originator mac is set and * outdated packets (especially uninitialized mac addresses) in the
@@ -208,7 +207,8 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,* errors. * * The skb is not consumed, so the caller should make sure that the -* skb is freed. */ +* skb is freed. +*/ int batadv_add_bcast_packet_to_list (struct bat_priv *bat_priv,const struct sk_buff *skb,unsigned long delay)
@@ -328,8 +328,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work) bat_priv->bat_algo_ops->bat_ogm_emit (forw_packet); -/** -* we have to have at least one packet in the queue +/* we have to have at least one packet in the queue * to determine the queues wake up time unless we are * shutting down */
@@ -364,8 +363,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,hlist_for_each_entry_safe (forw_packet, tmp_node, safe_tmp_node, &bat_priv->forw_bcast_list, list) { -/** -* if purge_outstanding_packets() was called with an argument +/* if purge_outstanding_packets() was called with an argument * we delete only packets belonging to the given interface */ if ((hard_iface) &&
@@ -374,8 +372,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,spin_unlock_bh (&bat_priv->forw_bcast_list_lock); -/** -* send_outstanding_bcast_packet() will lock the list to +/* send_outstanding_bcast_packet() will lock the list to * delete the item from the list */ pending =cancel_delayed_work_sync (&forw_packet->delayed_work);
@@ -393,8 +390,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,hlist_for_each_entry_safe (forw_packet, tmp_node, safe_tmp_node, &bat_priv->forw_bat_list, list) { -/** -* if purge_outstanding_packets() was called with an argument +/* if purge_outstanding_packets() was called with an argument * we delete only packets belonging to the given interface */ if ((hard_iface) &&
@@ -403,8 +399,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,spin_unlock_bh (&bat_priv->forw_bat_list_lock); -/** -* send_outstanding_bat_packet() will lock the list to +/* send_outstanding_bat_packet() will lock the list to * delete the item from the list */ pending =cancel_delayed_work_sync (&forw_packet->delayed_work);
send.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_SEND_H_
soft-interface.c +14 -13
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -66,8 +64,7 @@ int batadv_skb_head_push(struct sk_buff *skb, unsigned int len) {int result; -/** -* TODO: We must check if we can release all references to non-payload +/* TODO: We must check if we can release all references to non-payload * data using skb_header_release in our skbs to allow skb_cow_header to * work optimally. This means that those skbs are not allowed to read * or write any data which is before the current position of skb->data
@@ -182,14 +179,16 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)switch (atomic_read (&bat_priv->gw_mode)) {case GW_MODE_SERVER :/* gateway servers should not send dhcp -* requests into the mesh */ +* requests into the mesh +*/ ret =batadv_gw_is_dhcp_target (skb, &header_len);if (ret) goto dropped;break ;case GW_MODE_CLIENT :/* gateway clients should send dhcp requests -* via unicast to their gateway */ +* via unicast to their gateway +*/ ret =batadv_gw_is_dhcp_target (skb, &header_len);if (ret) do_bcast = false;
@@ -220,7 +219,8 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) bcast_packet->header.packet_type =BAT_BCAST ;/* hw address of first interface is the orig mac because only -* this mac is known throughout the mesh */ +* this mac is known throughout the mesh +*/ memcpy (bcast_packet->orig, primary_if->net_dev->dev_addr,ETH_ALEN );
@@ -231,7 +231,8 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)batadv_add_bcast_packet_to_list (bat_priv, skb, brd_delay);/* a copy is stored in the bcast list, therefore removing -* the original skb. */ +* the original skb. +*/ kfree_skb (skb);/* unicast packet */
@@ -307,9 +308,10 @@ void batadv_interface_rx(struct net_device *soft_iface,/* should not be necessary anymore as we use skb_pull_rcsum() * TODO: please verify this and remove this TODO -* -- Dec 21st 2009, Simon Wunderlich */ +* -- Dec 21st 2009, Simon Wunderlich +*/ -/* skb->ip_summed = CHECKSUM_UNNECESSARY;*/ +/* skb->ip_summed = CHECKSUM_UNNECESSARY; */ bat_priv->stats.rx_packets++; bat_priv->stats.rx_bytes += skb->len +ETH_HLEN ;
@@ -354,8 +356,7 @@ static void interface_setup(struct net_device *dev) dev->destructor = free_netdev; dev->tx_queue_len =0 ; -/** -* can't call min_mtu, because the needed variables +/* can't call min_mtu, because the needed variables * have not been initialized yet */ dev->mtu =ETH_DATA_LEN ;
soft-interface.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_
translation-table.c +56 -34
255 lines not on this page · raw message
translation-table.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich, Antonio Quartulli *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_
types.h +13 -16
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich *
@@ -16,11 +15,8 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ - -#ifndef _NET_BATMAN_ADV_TYPES_H_#define _NET_BATMAN_ADV_TYPES_H_
@@ -60,8 +56,7 @@ struct hard_iface {struct rcu_head rcu; }; -/** -* orig_node - structure for orig_list maintaining nodes of mesh +/* orig_node - structure for orig_list maintaining nodes of mesh * @primary_addr: hosts primary interface address * @last_seen: when last packet from this node was received * @bcast_seqno_reset: time when the broadcast seqno window was reset
@@ -100,7 +95,8 @@ struct orig_node {* If true, then I sent a Roaming_adv to this orig_node and I have to * inspect every packet directed to it to check whether it is still * the true destination or not. This flag will be reset to false as -* soon as I receive a new TTVN from this orig_node */ +* soon as I receive a new TTVN from this orig_node +*/ bool tt_poss_change;uint32_t last_real_seqno;uint8_t last_ttl;
@@ -115,7 +111,8 @@ struct orig_node {struct bat_priv *bat_priv;unsigned long last_frag_packet;/* ogm_cnt_lock protects: bcast_own, bcast_own_sum, -* neigh_node->real_bits, neigh_node->real_packet_count */ +* neigh_node->real_bits, neigh_node->real_packet_count +*/ spinlock_t ogm_cnt_lock;/* bcast_seqno_lock protects bcast_bits, last_bcast_seqno */ spinlock_t bcast_seqno_lock;
@@ -132,8 +129,7 @@ struct gw_node {struct rcu_head rcu; }; -/** -* neigh_node +/* neigh_node * @last_seen: when last packet via this neighbor was received */ struct neigh_node {
@@ -211,7 +207,8 @@ struct bat_priv {* If true, then I received a Roaming_adv and I have to inspect every * packet directed to me to check whether I am still the true * destination or not. This flag will be reset to false as soon as I -* increase my TTVN */ +* increase my TTVN +*/ bool tt_poss_change;char num_ifaces;struct debug_log *debug_log;
@@ -349,8 +346,7 @@ struct tt_roam_node {struct list_head list; }; -/** -* forw_packet - structure for forw_list maintaining packets to be +/* forw_packet - structure for forw_list maintaining packets to be * send/forwarded */ struct forw_packet {
@@ -392,7 +388,8 @@ struct frag_packet_list_entry {struct vis_info {unsigned long first_seen;/* list of server-neighbors we received a vis-packet -* from. we should not reply to them. */ +* from. we should not reply to them. +*/ struct list_head recv_list;struct list_head send_list;struct kref refcount;
@@ -400,7 +397,7 @@ struct vis_info {struct bat_priv *bat_priv;/* this packet might be part of the vis send queue. */ struct sk_buff *skb_packet; -/* vis_info may follow here*/ +/* vis_info may follow here */ } __packed;struct vis_info_entry {
unicast.c +6 -7
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: * * Andreas Langer *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -366,12 +364,12 @@ int batadv_unicast_generic_send_skb(struct sk_buff *skb, }/* check for tt host - increases orig_node refcount. -* returns NULL in case of AP isolation */ +* returns NULL in case of AP isolation +*/ orig_node =batadv_transtable_search (bat_priv, ethhdr->h_source, ethhdr->h_dest); find_router: -/** -* find_router(): +/* find_router(): * - if orig_node is NULL it returns NULL * - increases neigh_nodes refcount if found. */
@@ -399,7 +397,8 @@ find_router:/* inform the destination ode that we are still missing a correct route * for this client. The destination will receive this packet and will * try to reroute it because the ttvn contained in the header is less -* than the current one */ +* than the current one +*/ if (batadv_tt_global_client_is_roaming (bat_priv, ethhdr->h_dest)) unicast_packet->ttvn = unicast_packet->ttvn -1 ;
unicast.h +1 -3
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2010-2012 B.A.T.M.A.N. contributors: * * Andreas Langer *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_UNICAST_H_
vis.c +24 -15
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2008-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2008-2012 B.A.T.M.A.N. contributors: * * Simon Wunderlich *
@@ -16,7 +15,6 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #include "main.h"
@@ -64,8 +62,9 @@ static int vis_info_cmp(const struct hlist_node *node, const void *data2)return compare_eth (p1->vis_orig, p2->vis_orig); } -/* hash function to choose an entry in a hash table of given size */ -/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ +/* hash function to choose an entry in a hash table of given size +* hash algorithm from http://en.wikipedia.org/wiki/Hash_table +*/ static uint32_t vis_info_choose (const void *data,uint32_t size) {const struct vis_info *vis_info = data;
@@ -118,7 +117,8 @@ static struct vis_info *vis_hash_find(struct bat_priv *bat_priv, }/* insert interface to the list of interfaces of one originator, if it -* does not already exist in the list */ +* does not already exist in the list +*/ static void vis_data_insert_interface (const uint8_t *interface,struct hlist_head *if_list,bool primary)
@@ -334,7 +334,8 @@ out: }/* add the info packet to the send list, if it was not -* already linked in. */ +* already linked in. +*/ static void send_list_add (struct bat_priv *bat_priv,struct vis_info *info) {if (list_empty (&info->send_list)) {
@@ -344,7 +345,8 @@ static void send_list_add(struct bat_priv *bat_priv, struct vis_info *info) }/* delete the info packet from the send list, if it was -* linked in. */ +* linked in. +*/ static void send_list_del (struct vis_info *info) {if (!list_empty (&info->send_list)) {
@@ -388,7 +390,8 @@ static int recv_list_is_in(struct bat_priv *bat_priv,/* try to add the packet to the vis_hash. return NULL if invalid (e.g. too old, * broken.. ). vis hash must be locked outside. is_new is set when the packet -* is newer than old entries in the hash. */ +* is newer than old entries in the hash. +*/ static struct vis_info *add_packet(struct bat_priv *bat_priv, struct vis_packet *vis_packet, int vis_info_len, int *is_new,
@@ -500,7 +503,8 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, goto end;/* only if we are server ourselves and packet is newer than the one in -* hash.*/ +* hash. +*/ if (vis_server ==VIS_TYPE_SERVER_SYNC && is_new)send_list_add (bat_priv, info); end:
@@ -554,7 +558,8 @@ end:/* Walk the originators and find the VIS server with the best tq. Set the packet * address to its address and return the best_tq. * -* Must be called with the originator hash locked */ +* Must be called with the originator hash locked +*/ static int find_best_vis_server (struct bat_priv *bat_priv,struct vis_info *info) {
@@ -605,7 +610,8 @@ static bool vis_packet_full(const struct vis_info *info) }/* generates a packet of own vis data, -* returns 0 on success, -1 if no packet could be generated */ +* returns 0 on success, -1 if no packet could be generated +*/ static int generate_vis_packet (struct bat_priv *bat_priv) {struct hashtable_t *hash = bat_priv->orig_hash;
@@ -703,7 +709,8 @@ unlock: }/* free old vis packets. Must be called with this vis_hash_lock -* held */ +* held +*/ static void purge_vis_packets (struct bat_priv *bat_priv) {uint32_t i;
@@ -762,7 +769,8 @@ static void broadcast_vis_packet(struct bat_priv *bat_priv,continue ;/* don't send it if we already received the packet from -* this node. */ +* this node. +*/ if (recv_list_is_in (bat_priv, &info->recv_list, orig_node->orig)) {batadv_neigh_node_free_ref (router);
@@ -879,7 +887,8 @@ static void send_vis_packets(struct work_struct *work) }/* init the vis server. this may only be called when if_list is already -* initialized (e.g. bat0 is initialized, interfaces have been added) */ +* initialized (e.g. bat0 is initialized, interfaces have been added) +*/ int batadv_vis_init (struct bat_priv *bat_priv) {struct vis_packet *packet;
vis.h +3 -5
@@ -1,5 +1,4 @@ -/* -* Copyright (C) 2008-2012 B.A.T.M.A.N. contributors: +/* Copyright (C) 2008-2012 B.A.T.M.A.N. contributors: * * Simon Wunderlich, Marek Lindner *
@@ -16,14 +15,13 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA -* */ #ifndef _NET_BATMAN_ADV_VIS_H_#define _NET_BATMAN_ADV_VIS_H_ -#define VIS_TIMEOUT 200000/* timeout of vis packets -* in miliseconds */ +/* timeout of vis packets in miliseconds */ +#define VIS_TIMEOUT 200000int batadv_vis_seq_print_text (struct seq_file *seq,void *offset); void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
Signature · 1 line
1.7.10