Skip to contentSkip to conversation

multiple mesh clouds (2)

B.A.T.M.A.N. New Marek Lindner 1 participant 4 messages Jul 11, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

here we go with the next batch which has been rebased on the latest trunk and is checkpatch clean.

Cheers,
Marek

#1 lore raw

PATCH 1/3 batman-adv: attach each hard-interface to a soft-interface

This patch replaces the static bat0 interface with a dynamic/abstracted approach. It is now possible to create multiple batX interfaces by assigning hard interfaces to them. Each batX interface acts as an independent mesh network. A soft interface is removed once no hard interface references it any longer.

---
 batman-adv/aggregation.c       |    3 +-
 batman-adv/bat_sysfs.c         |   56 ++++++----------
 batman-adv/bitarray.c          |    7 +-
 batman-adv/bitarray.h          |    4 +-
 batman-adv/gateway_client.c    |   20 ++---
 batman-adv/gateway_client.h    |    7 +-
 batman-adv/hard-interface.c    |  119 ++++++++++++++++++++------------
 batman-adv/hard-interface.h    |    6 +-
 batman-adv/hash.c              |    6 +-
 batman-adv/hash.h              |    4 +-
 batman-adv/icmp_socket.c       |    6 +-
 batman-adv/main.c              |   54 +--------------
 batman-adv/main.h              |    2 -
 batman-adv/originator.c        |   43 ++++++------
 batman-adv/originator.h        |    2 +-
 batman-adv/routing.c           |  147 ++++++++++++++++++++++------------------
 batman-adv/routing.h           |   10 ++--
 batman-adv/send.c              |   47 ++++++-------
 batman-adv/send.h              |    2 +-
 batman-adv/soft-interface.c    |  126 +++++++++++++++++++++++++++-------
 batman-adv/soft-interface.h    |    8 ++-
 batman-adv/translation-table.c |   57 ++++++++-------
 batman-adv/translation-table.h |   13 ++--
 batman-adv/types.h             |    2 +
 batman-adv/vis.c               |   13 ++--
 25 files changed, 407 insertions(+), 357 deletions(-)
batman-adv/aggregation.c +1 -2
index d738b7a..853a74c 100644
@@ -106,8 +106,7 @@ static void new_aggregated_packet(unsigned char *packet_buff,
 {
 	struct forw_packet *forw_packet_aggr;
 	unsigned long flags;
-	/* FIXME: each batman_if will be attached to a softif */
-	struct bat_priv *bat_priv = netdev_priv(soft_device);
+	struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
 
 	/* own packet should always be scheduled */
 	if (!own_packet) {
batman-adv/bat_sysfs.c +20 -36

83 lines not on this page · raw message

batman-adv/bitarray.c +3 -4
index dd4193c..eb2dd70 100644
@@ -125,11 +125,10 @@ 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, int32_t seq_num_diff,
-		    int8_t set_mark)
+char bit_get_packet(void *priv, TYPE_OF_WORD *seq_bits,
+		    int32_t seq_num_diff, int8_t set_mark)
 {
-	/* FIXME: each orig_node->batman_if will be attached to a softif */
-	struct bat_priv *bat_priv = netdev_priv(soft_device);
+	struct bat_priv *bat_priv = (struct bat_priv *)priv;
 
 	/* sequence number is slightly older. We already got a sequence number
 	 * higher than this one, so we just mark it. */
batman-adv/bitarray.h +2 -2
index 01897d6..caa545c 100644
@@ -37,8 +37,8 @@ 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, int32_t seq_num_diff,
-					int8_t set_mark);
+char bit_get_packet(void *priv, 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? */
 int  bit_packet_count(TYPE_OF_WORD *seq_bits);
batman-adv/gateway_client.c +8 -12
index f50bc41..d2de0e1 100644
@@ -54,10 +54,8 @@ void gw_deselect(void)
 	spin_unlock(&curr_gw_lock);
 }
 
-void gw_election(void)
+void gw_election(struct bat_priv *bat_priv)
 {
-	/* FIXME: get bat_priv */
-	struct bat_priv *bat_priv = netdev_priv(soft_device);
 	struct gw_node *gw_node, *curr_gw_tmp = NULL;
 	uint8_t max_tq = 0;
 	uint32_t max_gw_factor = 0, tmp_gw_factor = 0;
@@ -209,10 +207,9 @@ deselect:
 	gw_deselect();
 }
 
-static void gw_node_add(struct orig_node *orig_node, uint8_t new_gwflags)
+static void gw_node_add(struct bat_priv *bat_priv,
+			struct orig_node *orig_node, uint8_t new_gwflags)
 {
-	/* FIXME: each orig_node->batman_if will be attached to a softif */
-	struct bat_priv *bat_priv = netdev_priv(soft_device);
 	struct gw_node *gw_node;
 	int down, up;
 
@@ -236,10 +233,9 @@ static void gw_node_add(struct orig_node *orig_node, uint8_t new_gwflags)
 		(up > 2048 ? "MBit" : "KBit"));
 }
 
-void gw_node_update(struct orig_node *orig_node, uint8_t new_gwflags)
+void gw_node_update(struct bat_priv *bat_priv,
+		    struct orig_node *orig_node, uint8_t new_gwflags)
 {
-	/* FIXME: each orig_node->batman_if will be attached to a softif */
-	struct bat_priv *bat_priv = netdev_priv(soft_device);
 	struct gw_node *gw_node;
 
 	rcu_read_lock();
@@ -273,12 +269,12 @@ void gw_node_update(struct orig_node *orig_node, uint8_t new_gwflags)
 	if (new_gwflags == 0)
 		return;
 
-	gw_node_add(orig_node, new_gwflags);
+	gw_node_add(bat_priv, orig_node, new_gwflags);
 }
 
-void gw_node_delete(struct orig_node *orig_node)
+void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node)
 {
-	return gw_node_update(orig_node, 0);
+	return gw_node_update(bat_priv, orig_node, 0);
 }
 
 static void gw_node_free(struct rcu_head *rcu)
batman-adv/gateway_client.h +4 -3
index 1c24187..19a82a7 100644
@@ -23,11 +23,12 @@
 #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
 
 void gw_deselect(void);
-void gw_election(void);
+void gw_election(struct bat_priv *bat_priv);
 void *gw_get_selected(void);
 void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node);
-void gw_node_update(struct orig_node *orig_node, uint8_t new_gwflags);
-void gw_node_delete(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_deleted(void);
 void gw_node_list_free(void);
 int gw_client_seq_print_text(struct seq_file *seq, void *offset);
batman-adv/hard-interface.c +75 -44

276 lines not on this page · raw message

batman-adv/hard-interface.h +3 -3
index d5640b0..4b49527 100644
@@ -32,14 +32,14 @@
 extern struct notifier_block hard_if_notifier;
 
 struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev);
-int hardif_enable_interface(struct batman_if *batman_if);
+int hardif_enable_interface(struct batman_if *batman_if, char *iface_name);
 void hardif_disable_interface(struct batman_if *batman_if);
 void hardif_remove_interfaces(void);
 int batman_skb_recv(struct sk_buff *skb,
 				struct net_device *dev,
 				struct packet_type *ptype,
 				struct net_device *orig_dev);
-int hardif_min_mtu(void);
-void update_min_mtu(void);
+int hardif_min_mtu(struct net_device *soft_iface);
+void update_min_mtu(struct net_device *soft_iface);
 
 #endif /* _NET_BATMAN_ADV_HARD_INTERFACE_H_ */
batman-adv/hash.c +3 -3
index 1286f8f..8ef26eb 100644
@@ -36,7 +36,7 @@ static void hash_init(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. */
-void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb)
+void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb, void *arg)
 {
 	struct element_t *bucket, *last_bucket;
 	int i;
@@ -46,7 +46,7 @@ void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb)
 
 		while (bucket != NULL) {
 			if (free_cb != NULL)
-				free_cb(bucket->data);
+				free_cb(bucket->data, arg);
 
 			last_bucket = bucket;
 			bucket = bucket->next;
@@ -300,7 +300,7 @@ struct hashtable_t *hash_resize(struct hashtable_t *hash, int size)
 
 	/* remove hash and eventual overflow buckets but not the content
 	 * itself. */
-	hash_delete(hash, NULL);
+	hash_delete(hash, NULL, NULL);
 
 	return new_hash;
 }
batman-adv/hash.h +2 -2
index c483e11..2c8e176 100644
@@ -30,7 +30,7 @@
 
 typedef int (*hashdata_compare_cb)(void *, void *);
 typedef int (*hashdata_choose_cb)(void *, int);
-typedef void (*hashdata_free_cb)(void *);
+typedef void (*hashdata_free_cb)(void *, void *);
 
 struct element_t {
 	void *data;		/* pointer to the data */
@@ -70,7 +70,7 @@ void *hash_remove_bucket(struct hashtable_t *hash, struct hash_it_t *hash_it_t);
 /* 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. */
-void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb);
+void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb, void *arg);
 
 /* free only the hashtable and the hash itself. */
 void hash_destroy(struct hashtable_t *hash);
batman-adv/icmp_socket.c +3 -3
index a84e84d..2660516 100644
@@ -69,6 +69,7 @@ static int bat_socket_open(struct inode *inode, struct file *file)
 	INIT_LIST_HEAD(&socket_client->queue_list);
 	socket_client->queue_len = 0;
 	socket_client->index = i;
+	socket_client->bat_priv = inode->i_private;
 	spin_lock_init(&socket_client->lock);
 	init_waitqueue_head(&socket_client->queue_wait);
 
@@ -155,10 +156,9 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,
 static ssize_t bat_socket_write(struct file *file, const char __user *buff,
 				size_t len, loff_t *off)
 {
-	/* FIXME: each orig_node->batman_if will be attached to a softif */
-	struct bat_priv *bat_priv = netdev_priv(soft_device);
 	struct socket_client *socket_client =
 		(struct socket_client *)file->private_data;
+	struct bat_priv *bat_priv = socket_client->bat_priv;
 	struct icmp_packet_rr icmp_packet;
 	struct orig_node *orig_node;
 	struct batman_if *batman_if;
@@ -277,7 +277,7 @@ int bat_socket_setup(struct bat_priv *bat_priv)
 		goto err;
 
 	d = debugfs_create_file(ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR,
-				bat_priv->debug_dir, NULL, &fops);
+				bat_priv->debug_dir, bat_priv, &fops);
 	if (d)
 		goto err;
 
batman-adv/main.c +2 -52

94 lines not on this page · raw message

batman-adv/main.h +0 -2
index 6d759f0..70d6e36 100644
@@ -138,8 +138,6 @@ extern spinlock_t forw_bcast_list_lock;
 
 extern int16_t num_hna;
 
-extern struct net_device *soft_device;
-
 extern unsigned char broadcast_addr[];
 extern atomic_t module_state;
 extern struct workqueue_struct *bat_event_workqueue;
batman-adv/originator.c +21 -22

122 lines not on this page · raw message

batman-adv/originator.h +1 -1
index e88411d..bc47c68 100644
@@ -25,7 +25,7 @@
 int originator_init(void);
 void originator_free(void);
 void purge_orig(struct work_struct *work);
-struct orig_node *get_orig_node(uint8_t *addr);
+struct orig_node *get_orig_node(struct bat_priv *bat_priv, uint8_t *addr);
 struct neigh_node *
 create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node,
 		uint8_t *neigh, struct batman_if *if_incoming);
batman-adv/routing.c +80 -67

396 lines not on this page · raw message

batman-adv/routing.h +5 -5
index 81c684f..67f2842 100644
@@ -29,14 +29,14 @@ 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);
-void update_routes(struct orig_node *orig_node,
-				struct neigh_node *neigh_node,
-				unsigned char *hna_buff, int hna_buff_len);
+void update_routes(struct bat_priv *bat_priv, 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, struct batman_if *recv_if);
 int recv_ucast_frag_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_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if);
+int recv_vis_packet(struct sk_buff *skb, struct batman_if *recv_if);
 int recv_bat_packet(struct sk_buff *skb,
 				struct batman_if *batman_if);
 struct neigh_node *find_router(struct orig_node *orig_node,
batman-adv/send.c +23 -24

115 lines not on this page · raw message

batman-adv/send.h +1 -1
index b64c627..2c48042 100644
@@ -35,7 +35,7 @@ void schedule_forward_packet(struct orig_node *orig_node,
 			     struct batman_packet *batman_packet,
 			     uint8_t directlink, int hna_buff_len,
 			     struct batman_if *if_outgoing);
-int  add_bcast_packet_to_list(struct sk_buff *skb);
+int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb);
 void send_outstanding_bat_packet(struct work_struct *work);
 void purge_outstanding_packets(struct batman_if *batman_if);
 
batman-adv/soft-interface.c +99 -27

231 lines not on this page · raw message

batman-adv/soft-interface.h +5 -3
index 6364854..dd5cf4d 100644
@@ -23,10 +23,12 @@
 #define _NET_BATMAN_ADV_SOFT_INTERFACE_H_
 
 void set_main_if_addr(uint8_t *addr);
-void interface_setup(struct net_device *dev);
-int interface_tx(struct sk_buff *skb, struct net_device *dev);
-void interface_rx(struct sk_buff *skb, int hdr_size);
+int interface_tx(struct sk_buff *skb, struct net_device *soft_iface);
+void interface_rx(struct net_device *soft_iface,
+		  struct sk_buff *skb, int hdr_size);
 int my_skb_push(struct sk_buff *skb, unsigned int len);
+struct net_device *softif_create(char *name);
+void softif_destroy(struct net_device *soft_iface);
 
 extern unsigned char main_if_addr[];
 
batman-adv/translation-table.c +30 -27

167 lines not on this page · raw message

batman-adv/translation-table.h +8 -5
index fa93e37..af7a59c 100644
@@ -25,16 +25,19 @@
 #include "types.h"
 
 int hna_local_init(void);
-void hna_local_add(uint8_t *addr);
-void hna_local_remove(uint8_t *addr, char *message);
+void hna_local_add(struct net_device *soft_iface, uint8_t *addr);
+void hna_local_remove(struct bat_priv *bat_priv,
+		      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_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);
+void hna_global_add_orig(struct bat_priv *bat_priv,
+			 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 orig_node *orig_node, char *message);
+void hna_global_del_orig(struct bat_priv *bat_priv,
+			 struct orig_node *orig_node, char *message);
 void hna_global_free(void);
 struct orig_node *transtable_search(uint8_t *addr);
 
batman-adv/types.h +2 -0
index e3c4d2d..20cb0f7 100644
@@ -46,6 +46,7 @@ struct batman_if {
 	int packet_len;
 	struct kobject *hardif_obj;
 	struct rcu_head rcu;
+	struct net_device *soft_iface;
 };
 
 /**
@@ -142,6 +143,7 @@ struct socket_client {
 	unsigned char index;
 	spinlock_t lock;
 	wait_queue_head_t queue_wait;
+	struct bat_priv *bat_priv;
 };
 
 struct socket_packet {
batman-adv/vis.c +6 -7
index 5c825b5..5766148 100644
@@ -701,17 +701,16 @@ static void send_vis_packets(struct work_struct *work)
 {
 	struct vis_info *info, *temp;
 	unsigned long flags;
-	/* FIXME: each batman_if will be attached to a softif */
-	struct bat_priv *bat_priv = netdev_priv(soft_device);
+	/* struct bat_priv *bat_priv = netdev_priv(soft_device); */
 
 	spin_lock_irqsave(&vis_hash_lock, flags);
 
 	purge_vis_packets();
 
-	if (generate_vis_packet(bat_priv) == 0) {
+	/* if (generate_vis_packet(bat_priv) == 0) {*/
 		/* schedule if generation was successful */
-		send_list_add(my_vis_info);
-	}
+		/*send_list_add(my_vis_info);
+	} */
 
 	list_for_each_entry_safe(info, temp, &send_list, send_list) {
 
@@ -785,7 +784,7 @@ err:
 }
 
 /* Decrease the reference count on a hash item info */
-static void free_info_ref(void *data)
+static void free_info_ref(void *data, void *arg)
 {
 	struct vis_info *info = data;
 
@@ -804,7 +803,7 @@ void vis_quit(void)
 
 	spin_lock_irqsave(&vis_hash_lock, flags);
 	/* properly remove, kill timers ... */
-	hash_delete(vis_hash, free_info_ref);
+	hash_delete(vis_hash, free_info_ref, NULL);
 	vis_hash = NULL;
 	my_vis_info = NULL;
 	spin_unlock_irqrestore(&vis_hash_lock, flags);
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/3 batman-adv: multiple mesh clouds

In reply to Marek Lindner

This patch removes all remaining global variables and includes the necessary bits into the bat_priv structure. It is the last remaining piece to allow multiple concurrent mesh clouds on the same device.
A few global variables have been rendered obsolete during the process and have been removed entirely.

---
 batman-adv/aggregation.c       |   18 ++--
 batman-adv/bat_sysfs.c         |    2 +-
 batman-adv/gateway_client.c    |  101 +++++++--------
 batman-adv/gateway_client.h    |    8 +-
 batman-adv/gateway_common.c    |    4 +-
 batman-adv/hard-interface.c    |   40 +++---
 batman-adv/icmp_socket.c       |   11 +-
 batman-adv/main.c              |   77 ++++++------
 batman-adv/main.h              |   20 +--
 batman-adv/originator.c        |  122 ++++++++++--------
 batman-adv/originator.h        |    6 +-
 batman-adv/routing.c           |  116 +++++++++--------
 batman-adv/routing.h           |    5 +-
 batman-adv/send.c              |  107 ++++++++-------
 batman-adv/send.h              |    3 +-
 batman-adv/soft-interface.c    |   49 ++++----
 batman-adv/translation-table.c |  219 ++++++++++++++++---------------
 batman-adv/translation-table.h |   17 +--
 batman-adv/types.h             |   85 ++++++++++---
 batman-adv/vis.c               |  281 +++++++++++++++++++++-------------------
 batman-adv/vis.h               |   27 +----
 21 files changed, 690 insertions(+), 628 deletions(-)
batman-adv/aggregation.c +9 -9
index 853a74c..57f30a4 100644
@@ -104,9 +104,9 @@ static void new_aggregated_packet(unsigned char *packet_buff,
 			   struct batman_if *if_incoming,
 			   int own_packet)
 {
+	struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
 	struct forw_packet *forw_packet_aggr;
 	unsigned long flags;
-	struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
 
 	/* own packet should always be scheduled */
 	if (!own_packet) {
@@ -152,9 +152,9 @@ static void new_aggregated_packet(unsigned char *packet_buff,
 		forw_packet_aggr->direct_link_flags |= 1;
 
 	/* add new packet to packet list */
-	spin_lock_irqsave(&forw_bat_list_lock, flags);
-	hlist_add_head(&forw_packet_aggr->list, &forw_bat_list);
-	spin_unlock_irqrestore(&forw_bat_list_lock, flags);
+	spin_lock_irqsave(&bat_priv->forw_bat_list_lock, flags);
+	hlist_add_head(&forw_packet_aggr->list, &bat_priv->forw_bat_list);
+	spin_unlock_irqrestore(&bat_priv->forw_bat_list_lock, flags);
 
 	/* start timer for this packet */
 	INIT_DELAYED_WORK(&forw_packet_aggr->delayed_work,
@@ -198,11 +198,11 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
 	unsigned long flags;
 
 	/* find position for the packet in the forward queue */
-	spin_lock_irqsave(&forw_bat_list_lock, flags);
+	spin_lock_irqsave(&bat_priv->forw_bat_list_lock, flags);
 	/* own packets are not to be aggregated */
 	if ((atomic_read(&bat_priv->aggregation_enabled)) && (!own_packet)) {
-		hlist_for_each_entry(forw_packet_pos, tmp_node, &forw_bat_list,
-				     list) {
+		hlist_for_each_entry(forw_packet_pos, tmp_node,
+				     &bat_priv->forw_bat_list, list) {
 			if (can_aggregate_with(batman_packet,
 					       packet_len,
 					       send_time,
@@ -219,7 +219,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
 	 * suitable aggregation packet found */
 	if (forw_packet_aggr == NULL) {
 		/* the following section can run without the lock */
-		spin_unlock_irqrestore(&forw_bat_list_lock, flags);
+		spin_unlock_irqrestore(&bat_priv->forw_bat_list_lock, flags);
 
 		/**
 		 * if we could not aggregate this packet with one of the others
@@ -237,7 +237,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
 		aggregate(forw_packet_aggr,
 			  packet_buff, packet_len,
 			  direct_link);
-		spin_unlock_irqrestore(&forw_bat_list_lock, flags);
+		spin_unlock_irqrestore(&bat_priv->forw_bat_list_lock, flags);
 	}
 }
 
batman-adv/bat_sysfs.c +1 -1
index 422cf52..1331a02 100644
@@ -459,7 +459,7 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
 
 	return sprintf(buff, "%s\n",
 		       batman_if->if_status == IF_NOT_IN_USE ?
-							"none" : "bat0");
+					"none" : batman_if->soft_iface->name);
 }
 
 static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
batman-adv/gateway_client.c +46 -55

246 lines not on this page · raw message

batman-adv/gateway_client.h +4 -4
index 19a82a7..ce0b4f0 100644
@@ -22,15 +22,15 @@
 #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
 #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_
 
-void gw_deselect(void);
+void gw_deselect(struct bat_priv *bat_priv);
 void gw_election(struct bat_priv *bat_priv);
-void *gw_get_selected(void);
+void *gw_get_selected(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_deleted(void);
-void gw_node_list_free(void);
+void gw_node_purge_deleted(struct bat_priv *bat_priv);
+void gw_node_list_free(struct bat_priv *bat_priv);
 int gw_client_seq_print_text(struct seq_file *seq, void *offset);
 bool gw_is_target(struct bat_priv *bat_priv, struct sk_buff *skb);
 
batman-adv/gateway_common.c +2 -2
index 06bdd75..3851930 100644
@@ -261,7 +261,7 @@ next:
 		gw_srv_class_to_kbit((uint8_t)gw_class_tmp,
 				     (int *)&down, (int *)&up);
 
-		gw_deselect();
+		gw_deselect(bat_priv);
 		bat_info(net_dev, "Changing gateway mode from: '%s' to: '%s' "
 			 "(gw_class: %ld -> propagating: %ld%s/%ld%s)\n",
 			 gw_mode_curr_str, gw_mode_tmp_str, gw_class_tmp,
@@ -280,7 +280,7 @@ next:
 	atomic_set(&bat_priv->gw_class, gw_class_tmp);
 
 	if (gw_class_tmp == 0)
-		gw_deselect();
+		gw_deselect(bat_priv);
 
 end:
 	return count;
batman-adv/hard-interface.c +20 -20
index 791d27b..8208af1 100644
@@ -80,13 +80,15 @@ static int is_valid_iface(struct net_device *net_dev)
 	return 1;
 }
 
-static struct batman_if *get_active_batman_if(void)
+static struct batman_if *get_active_batman_if(struct net_device *soft_iface)
 {
 	struct batman_if *batman_if;
 
-	/* TODO: should check interfaces belonging to bat_priv */
 	rcu_read_lock();
 	list_for_each_entry_rcu(batman_if, &if_list, list) {
+		if (batman_if->soft_iface != soft_iface)
+			continue;
+
 		if (batman_if->if_status == IF_ACTIVE)
 			goto out;
 	}
@@ -118,7 +120,7 @@ static void set_primary_if(struct bat_priv *bat_priv,
 	 * hacky trick to make sure that we send the HNA information via
 	 * our new primary interface
 	 */
-	atomic_set(&hna_local_changed, 1);
+	atomic_set(&bat_priv->hna_local_changed, 1);
 }
 
 static bool hardif_is_iface_up(struct batman_if *batman_if)
@@ -221,9 +223,6 @@ static void hardif_activate_interface(struct batman_if *batman_if)
 	bat_info(batman_if->soft_iface, "Interface activated: %s\n",
 		 batman_if->dev);
 
-	if (atomic_read(&module_state) == MODULE_INACTIVE)
-		activate_module();
-
 	update_min_mtu(batman_if->soft_iface);
 	return;
 }
@@ -346,11 +345,16 @@ void hardif_disable_interface(struct batman_if *batman_if)
 	orig_hash_del_if(batman_if, bat_priv->num_ifaces);
 
 	if (batman_if == bat_priv->primary_if)
-		set_primary_if(bat_priv, get_active_batman_if());
+		set_primary_if(bat_priv,
+			       get_active_batman_if(batman_if->soft_iface));
 
 	kfree(batman_if->packet_buff);
 	batman_if->packet_buff = NULL;
 	batman_if->if_status = IF_NOT_IN_USE;
+
+	/* delete all references to this batman_if */
+	purge_orig_ref(bat_priv);
+	purge_outstanding_packets(bat_priv, batman_if);
 	dev_put(batman_if->soft_iface);
 
 	/* nobody uses this interface anymore */
@@ -358,10 +362,6 @@ void hardif_disable_interface(struct batman_if *batman_if)
 		softif_destroy(batman_if->soft_iface);
 
 	batman_if->soft_iface = NULL;
-
-	/*if ((atomic_read(&module_state) == MODULE_ACTIVE) &&
-	    (bat_priv->num_ifaces == 0))
-		deactivate_module();*/
 }
 
 static struct batman_if *hardif_add_interface(struct net_device *net_dev)
@@ -410,10 +410,6 @@ static void hardif_free_interface(struct rcu_head *rcu)
 {
 	struct batman_if *batman_if = container_of(rcu, struct batman_if, rcu);
 
-	/* delete all references to this batman_if */
-	purge_orig(NULL);
-	purge_outstanding_packets(batman_if);
-
 	kfree(batman_if->dev);
 	kfree(batman_if);
 }
@@ -511,9 +507,6 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
 	if (!skb)
 		goto err_out;
 
-	if (atomic_read(&module_state) != MODULE_ACTIVE)
-		goto err_free;
-
 	/* if netfilter/ebtables wants to block incoming batman
 	 * packets then give them a chance to do so here */
 	ret = NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, dev, NULL,
@@ -534,6 +527,14 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
 	if (!batman_if)
 		goto err_free;
 
+	if (!batman_if->soft_iface)
+		goto err_free;
+
+	bat_priv = netdev_priv(batman_if->soft_iface);
+
+	if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
+		goto err_free;
+
 	/* discard frames on not active interfaces */
 	if (batman_if->if_status != IF_ACTIVE)
 		goto err_free;
@@ -545,7 +546,6 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
 	}
 
 	batman_packet = (struct batman_packet *)skb->data;
-	bat_priv = netdev_priv(batman_if->soft_iface);
 
 	if (batman_packet->version != COMPAT_VERSION) {
 		bat_dbg(DBG_BATMAN, bat_priv,
@@ -565,7 +565,7 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
 
 		/* batman icmp packet */
 	case BAT_ICMP:
-		ret = recv_icmp_packet(skb);
+		ret = recv_icmp_packet(skb, batman_if);
 		break;
 
 		/* unicast packet */
batman-adv/icmp_socket.c +6 -5
index 2660516..8ef87c0 100644
@@ -205,11 +205,12 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
 		goto out;
 	}
 
-	if (atomic_read(&module_state) != MODULE_ACTIVE)
+	if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
 		goto dst_unreach;
 
-	spin_lock_irqsave(&orig_hash_lock, flags);
-	orig_node = ((struct orig_node *)hash_find(orig_hash, icmp_packet.dst));
+	spin_lock_irqsave(&bat_priv->orig_hash_lock, flags);
+	orig_node = ((struct orig_node *)hash_find(bat_priv->orig_hash,
+						   icmp_packet.dst));
 
 	if (!orig_node)
 		goto unlock;
@@ -220,7 +221,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
 	batman_if = orig_node->router->if_incoming;
 	memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
 
-	spin_unlock_irqrestore(&orig_hash_lock, flags);
+	spin_unlock_irqrestore(&bat_priv->orig_hash_lock, flags);
 
 	if (!batman_if)
 		goto dst_unreach;
@@ -239,7 +240,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
 	goto out;
 
 unlock:
-	spin_unlock_irqrestore(&orig_hash_lock, flags);
+	spin_unlock_irqrestore(&bat_priv->orig_hash_lock, flags);
 dst_unreach:
 	icmp_packet.msg_type = DESTINATION_UNREACHABLE;
 	bat_socket_add_packet(socket_client, &icmp_packet, packet_len);
batman-adv/main.c +38 -39

135 lines not on this page · raw message

batman-adv/main.h +5 -15
index 70d6e36..031c66a 100644
@@ -76,9 +76,9 @@
 #define EXPECTED_SEQNO_RANGE	65536
 /* don't reset again within 30 seconds */
 
-#define MODULE_INACTIVE 0
-#define MODULE_ACTIVE 1
-#define MODULE_DEACTIVATING 2
+#define MESH_INACTIVE 0
+#define MESH_ACTIVE 1
+#define MESH_DEACTIVATING 2
 
 #define BCAST_QUEUE_LEN		256
 #define BATMAN_QUEUE_LEN	256
@@ -128,22 +128,12 @@
 #endif
 
 extern struct list_head if_list;
-extern struct hlist_head forw_bat_list;
-extern struct hlist_head forw_bcast_list;
-extern struct hashtable_t *orig_hash;
-
-extern spinlock_t orig_hash_lock;
-extern spinlock_t forw_bat_list_lock;
-extern spinlock_t forw_bcast_list_lock;
-
-extern int16_t num_hna;
 
 extern unsigned char broadcast_addr[];
-extern atomic_t module_state;
 extern struct workqueue_struct *bat_event_workqueue;
 
-void activate_module(void);
-void deactivate_module(void);
+int mesh_init(struct net_device *soft_iface);
+void mesh_free(struct net_device *soft_iface);
 void inc_module_count(void);
 void dec_module_count(void);
 int addr_to_string(char *buff, uint8_t *addr);
batman-adv/originator.c +70 -52

265 lines not on this page · raw message

batman-adv/originator.h +3 -3
index bc47c68..a97c400 100644
@@ -22,9 +22,9 @@
 #ifndef _NET_BATMAN_ADV_ORIGINATOR_H_
 #define _NET_BATMAN_ADV_ORIGINATOR_H_
 
-int originator_init(void);
-void originator_free(void);
-void purge_orig(struct work_struct *work);
+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);
 struct orig_node *get_orig_node(struct bat_priv *bat_priv, uint8_t *addr);
 struct neigh_node *
 create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node,
batman-adv/routing.c +62 -54

367 lines not on this page · raw message

batman-adv/routing.h +2 -3
index 67f2842..06ea99d 100644
@@ -32,13 +32,12 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 void update_routes(struct bat_priv *bat_priv, 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_icmp_packet(struct sk_buff *skb, struct batman_if *recv_if);
 int recv_unicast_packet(struct sk_buff *skb, struct batman_if *recv_if);
 int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if);
 int recv_bcast_packet(struct sk_buff *skb, struct batman_if *recv_if);
 int recv_vis_packet(struct sk_buff *skb, struct batman_if *recv_if);
-int recv_bat_packet(struct sk_buff *skb,
-				struct batman_if *batman_if);
+int recv_bat_packet(struct sk_buff *skb, struct batman_if *recv_if);
 struct neigh_node *find_router(struct orig_node *orig_node,
 		struct batman_if *recv_if);
 void update_bonding_candidates(struct bat_priv *bat_priv,
batman-adv/send.c +56 -51

241 lines not on this page · raw message

batman-adv/send.h +2 -1
index 2c48042..c253f28 100644
@@ -37,6 +37,7 @@ void schedule_forward_packet(struct orig_node *orig_node,
 			     struct batman_if *if_outgoing);
 int add_bcast_packet_to_list(struct bat_priv *bat_priv, struct sk_buff *skb);
 void send_outstanding_bat_packet(struct work_struct *work);
-void purge_outstanding_packets(struct batman_if *batman_if);
+void purge_outstanding_packets(struct bat_priv *bat_priv,
+			       struct batman_if *batman_if);
 
 #endif /* _NET_BATMAN_ADV_SEND_H_ */
batman-adv/soft-interface.c +26 -23

137 lines not on this page · raw message

batman-adv/translation-table.c +112 -107

470 lines not on this page · raw message

batman-adv/translation-table.h +7 -10
index af7a59c..10c4c5c 100644
@@ -24,25 +24,22 @@
 
 #include "types.h"
 
-int hna_local_init(void);
+int hna_local_init(struct bat_priv *bat_priv);
 void hna_local_add(struct net_device *soft_iface, uint8_t *addr);
 void hna_local_remove(struct bat_priv *bat_priv,
 		      uint8_t *addr, char *message);
-int hna_local_fill_buffer(unsigned char *buff, int buff_len);
+int hna_local_fill_buffer(struct bat_priv *bat_priv,
+			  unsigned char *buff, int buff_len);
 int hna_local_seq_print_text(struct seq_file *seq, void *offset);
-void hna_local_free(void);
-int hna_global_init(void);
+void hna_local_free(struct bat_priv *bat_priv);
+int hna_global_init(struct bat_priv *bat_priv);
 void hna_global_add_orig(struct bat_priv *bat_priv,
 			 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 bat_priv *bat_priv,
 			 struct orig_node *orig_node, char *message);
-void hna_global_free(void);
-struct orig_node *transtable_search(uint8_t *addr);
-
-extern spinlock_t hna_local_hash_lock;
-extern struct hashtable_t *hna_local_hash;
-extern atomic_t hna_local_changed;
+void hna_global_free(struct bat_priv *bat_priv);
+struct orig_node *transtable_search(struct bat_priv *bat_priv, uint8_t *addr);
 
 #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
batman-adv/types.h +67 -18

131 lines not on this page · raw message

batman-adv/vis.c +150 -131

626 lines not on this page · raw message

batman-adv/vis.h +2 -25
index bb13bf1..2c3b330 100644
@@ -24,29 +24,6 @@
 
 #define VIS_TIMEOUT		200	/* timeout of vis packets in seconds */
 
-struct vis_info {
-	unsigned long       first_seen;
-	struct list_head    recv_list;
-			    /* list of server-neighbors we received a vis-packet
-			     * from.  we should not reply to them. */
-	struct list_head send_list;
-	struct kref refcount;
-	/* this packet might be part of the vis send queue. */
-	struct vis_packet packet;
-	/* vis_info may follow here*/
-} __attribute__((packed));
-
-struct vis_info_entry {
-	uint8_t  src[ETH_ALEN];
-	uint8_t  dest[ETH_ALEN];
-	uint8_t  quality;	/* quality = 0 means HNA */
-} __attribute__((packed));
-
-struct recvlist_node {
-	struct list_head list;
-	uint8_t mac[ETH_ALEN];
-};
-
 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,
@@ -54,7 +31,7 @@ void receive_server_sync_packet(struct bat_priv *bat_priv,
 void receive_client_update_packet(struct bat_priv *bat_priv,
 				  struct vis_packet *vis_packet,
 				  int vis_info_len);
-int vis_init(void);
-void vis_quit(void);
+int vis_init(struct bat_priv *bat_priv);
+void vis_quit(struct bat_priv *bat_priv);
 
 #endif /* _NET_BATMAN_ADV_VIS_H_ */
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/3 batctl: support for multiple mesh clouds

In reply to Marek Lindner

Since the batman-adv kernel supports multiple mesh clouds batctl comes with a new optional parameter '-m' which allows to specify the mesh cloud a specific command shall be applied to. It defaults to 'bat0' which guarantees compatibility with the previous behaviour.

---
 batctl/debug.c      |   11 +++++----
 batctl/debug.h      |    7 +++--
 batctl/debugfs.c    |    6 ++--
 batctl/debugfs.h    |    3 +-
 batctl/main.c       |   59 +++++++++++++++++++++++++++++++++++++-------------
 batctl/main.h       |    2 +-
 batctl/ping.c       |    4 +-
 batctl/ping.h       |    4 +-
 batctl/sys.c        |   44 ++++++++++++++++++++++++++-----------
 batctl/sys.h        |   10 ++++----
 batctl/traceroute.c |    6 ++--
 batctl/traceroute.h |    4 +-
 batctl/vis.c        |   16 +++++++-------
 batctl/vis.h        |    4 +-
 14 files changed, 114 insertions(+), 66 deletions(-)
batctl/debug.c +6 -5
index 3045f67..1dbc204 100644
@@ -70,7 +70,8 @@ void gateways_usage(void)
 	printf(" \t -w [interval] watch mode - refresh the gateway server list continuously\n");
 }
 
-int handle_debug_table(int argc, char **argv, char *file_path, void table_usage(void))
+int handle_debug_table(char *mesh_iface, int argc, char **argv,
+		       char *file_path, void table_usage(void))
 {
 	int optchar, read_opt = USE_BAT_HOSTS;
 	char full_path[MAX_PATH+1];
@@ -114,7 +115,7 @@ int handle_debug_table(int argc, char **argv, char *file_path, void table_usage(
 		case '?':
 			if (optopt == 't')
 				printf("Error - argument -t needs a number\n");
-			
+
 			else if (optopt == 'w') {
 				read_opt |= CLR_CONT_READ;
 				break;
@@ -135,7 +136,7 @@ int handle_debug_table(int argc, char **argv, char *file_path, void table_usage(
 		return EXIT_FAILURE;
 	}
 
-	debugfs_make_path(DEBUG_BATIF_PATH "/", full_path, sizeof(full_path));
+	debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface, full_path, sizeof(full_path));
 	return read_file(full_path, file_path, read_opt, orig_timeout, watch_interval);
 }
 
@@ -147,7 +148,7 @@ static void log_usage(void)
 	printf(" \t -n don't replace mac addresses with bat-host names\n");
 }
 
-int log_print(int argc, char **argv)
+int log_print(char *mesh_iface, int argc, char **argv)
 {
 	int optchar, res, read_opt = USE_BAT_HOSTS | LOG_MODE;
 	char full_path[MAX_PATH+1];
@@ -173,7 +174,7 @@ int log_print(int argc, char **argv)
 		return EXIT_FAILURE;
 	}
 
-	debugfs_make_path(DEBUG_BATIF_PATH "/", full_path, sizeof(full_path));
+	debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface, full_path, sizeof(full_path));
 	res = read_file(full_path, DEBUG_LOG, read_opt, 0, 0);
 
 	if ((res != EXIT_SUCCESS) && (errno == ENOENT))
batctl/debug.h +4 -3
index bc6d16c..8bed80e 100644
@@ -20,7 +20,7 @@
  */
 
 
-#define DEBUG_BATIF_PATH "batman_adv/bat0"
+#define DEBUG_BATIF_PATH_FMT "%s/batman_adv/%s"
 #define DEBUG_ORIGINATORS "originators"
 #define DEBUG_TRANSTABLE_LOCAL "transtable_local"
 #define DEBUG_TRANSTABLE_GLOBAL "transtable_global"
@@ -32,5 +32,6 @@ void originators_usage(void);
 void trans_local_usage(void);
 void trans_global_usage(void);
 void gateways_usage(void);
-int handle_debug_table(int argc, char **argv, char *file_path, void table_usage(void));
-int log_print(int argc, char **argv);
+int handle_debug_table(char *mesh_iface, int argc, char **argv,
+		       char *file_path, void table_usage(void));
+int log_print(char *mesh_iface, int argc, char **argv);
batctl/debugfs.c +3 -3
index 6d2222f..47a0475 100644
@@ -50,7 +50,7 @@ void debugfs_force_cleanup(void)
 }
 
 /* construct a full path to a debugfs element */
-int debugfs_make_path(const char *element, char *buffer, int size)
+int debugfs_make_path(const char *fmt, char *mesh_iface, char *buffer, int size)
 {
 	int len;
 
@@ -59,11 +59,11 @@ int debugfs_make_path(const char *element, char *buffer, int size)
 		return -1;
 	}
 
-	len = strlen(debugfs_mountpoint) + strlen(element) + 1;
+	len = strlen(debugfs_mountpoint) + strlen(fmt) + 1;
 	if (len >= size)
 		return len+1;
 
-	snprintf(buffer, size-1, "%s/%s", debugfs_mountpoint, element);
+	snprintf(buffer, size-1, fmt, debugfs_mountpoint, mesh_iface);
 	return 0;
 }
 
batctl/debugfs.h +2 -1
index 45f6339..a943e5b 100644
@@ -41,6 +41,7 @@ extern int debugfs_umount(void);
 extern int debugfs_write(const char *entry, const char *value);
 extern int debugfs_read(const char *entry, char *buffer, size_t size);
 extern void debugfs_force_cleanup(void);
-extern int debugfs_make_path(const char *element, char *buffer, int size);
+extern int debugfs_make_path(const char *fmt, char *mesh_iface,
+			     char *buffer, int size);
 
 #endif /* __DEBUGFS_H__ */
batctl/main.c +43 -16

143 lines not on this page · raw message

batctl/main.h +1 -1
index 261256d..793d282 100644
@@ -23,4 +23,4 @@
 
 #define SOURCE_VERSION "devel"  /*put exactly one distinct word inside the string like "0.3-pre-alpha" or "0.3-rc1" or "0.3" */
 
-#define SOCKET_PATH "batman_adv/bat0/socket"
+#define SOCKET_PATH_FMT "%s/batman_adv/%s/socket"
batctl/ping.c +2 -2
index 7820e32..affd6ad 100644
@@ -65,7 +65,7 @@ void sig_handler(int sig)
 	}
 }
 
-int ping(int argc, char **argv)
+int ping(char *mesh_iface, int argc, char **argv)
 {
 	struct icmp_packet_rr icmp_packet_out, icmp_packet_in;
 	struct timeval tv;
@@ -149,7 +149,7 @@ int ping(int argc, char **argv)
 		goto out;
 	}
 
-	debugfs_make_path(SOCKET_PATH, icmp_socket, sizeof(icmp_socket));
+	debugfs_make_path(SOCKET_PATH_FMT, mesh_iface, icmp_socket, sizeof(icmp_socket));
 
 	ping_fd = open(icmp_socket, O_RDWR);
 
batctl/ping.h +2 -2
index d578f2a..a5eeb1e 100644
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors:
  *
  * Marek Lindner <[email protected]>
@@ -21,4 +21,4 @@
 
 
 
-int ping(int argc, char **argv);
+int ping(char *mesh_iface, int argc, char **argv);
batctl/sys.c +31 -13

119 lines not on this page · raw message

batctl/sys.h +5 -5
index 7e0d52e..71362f1 100644
@@ -20,7 +20,7 @@
  */
 
 
-#define SYS_BATIF_PATH "/sys/class/net/bat0/mesh/"
+#define SYS_BATIF_PATH_FMT "/sys/class/net/%s/mesh/"
 #define SYS_LOG_LEVEL "log_level"
 #define SYS_LOG "log"
 #define SYS_AGGR "aggregated_ogms"
@@ -42,8 +42,8 @@ void fragmentation_usage(void);
 void gw_mode_usage(void);
 void vis_mode_usage(void);
 void orig_interval_usage(void);
-int interface(int argc, char **argv);
-int handle_loglevel(int argc, char **argv);
-int handle_sys_setting(int argc, char **argv, char *file_path,
-		       void setting_usage(void),
+int interface(char *mesh_iface, int argc, char **argv);
+int handle_loglevel(char *mesh_iface, int argc, char **argv);
+int handle_sys_setting(char *mesh_iface, int argc, char **argv,
+		       char *file_path, void setting_usage(void),
 		       const char *sysfs_param[]);
batctl/traceroute.c +3 -3
index f5b63f9..bcfe146 100644
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
  *
  * Andreas Langer <[email protected]>, Marek Lindner <[email protected]>
@@ -48,7 +48,7 @@ void traceroute_usage(void)
 	printf(" \t -n don't convert addresses to bat-host names\n");
 }
 
-int traceroute(int argc, char **argv)
+int traceroute(char *mesh_iface, int argc, char **argv)
 {
 	struct icmp_packet icmp_packet_out, icmp_packet_in;
 	struct bat_host *bat_host;
@@ -108,7 +108,7 @@ int traceroute(int argc, char **argv)
 		goto out;
 	}
 
-	debugfs_make_path(SOCKET_PATH, icmp_socket, sizeof(icmp_socket));
+	debugfs_make_path(SOCKET_PATH_FMT, mesh_iface, icmp_socket, sizeof(icmp_socket));
 
 	trace_fd = open(icmp_socket, O_RDWR);
 
batctl/traceroute.h +2 -2
index f1a2dd2..0eff114 100644
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors:
  *
  * Marek Lindner <[email protected]>
@@ -21,4 +21,4 @@
 
 
 
-int traceroute(int argc, char **argv);
+int traceroute(char *mesh_iface, int argc, char **argv);
batctl/vis.c +8 -8
index 36152cf..ad612ff 100644
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors:
  *
  * Andrew Lunn <[email protected]>
@@ -164,7 +164,7 @@ const struct funcs json_funcs = { json_print_tq,
 	NULL
 };
 
-static FILE *open_vis(void)
+static FILE *open_vis(char *mesh_iface)
 {
 	char full_path[MAX_PATH+1];
 	char *debugfs_mnt;
@@ -175,12 +175,12 @@ static FILE *open_vis(void)
 		return NULL;
 	}
 
-	debugfs_make_path(DEBUG_BATIF_PATH "/" DEBUG_VIS_DATA, full_path, sizeof(full_path));
+	debugfs_make_path(DEBUG_BATIF_PATH_FMT "/" DEBUG_VIS_DATA, mesh_iface, full_path, sizeof(full_path));
 
 	return fopen(full_path, "r");
 }
 
-static int format(const struct funcs *funcs)
+static int format(char *mesh_iface, const struct funcs *funcs)
 {
 	size_t len = 0;
 	ssize_t read;
@@ -194,7 +194,7 @@ static int format(const struct funcs *funcs)
 	long tq;
 	char *flag;
 
-	FILE *fp = open_vis();
+	FILE *fp = open_vis(mesh_iface);
 
 	if (!fp)
 		return EXIT_FAILURE;
@@ -246,7 +246,7 @@ static int format(const struct funcs *funcs)
 	return EXIT_SUCCESS;
 }
 
-int vis_data(int argc, char *argv[])
+int vis_data(char *mesh_iface, int argc, char *argv[])
 {
 	bool dot = false;
 	bool json = false;
@@ -306,10 +306,10 @@ int vis_data(int argc, char *argv[])
 		bat_hosts_init();
 
 	if (dot)
-		return format(&dot_funcs);
+		return format(mesh_iface, &dot_funcs);
 
 	if (json)
-		return format(&json_funcs);
+		return format(mesh_iface, &json_funcs);
 
 	return EXIT_FAILURE;
 }
batctl/vis.h +2 -2
index 7e6b85f..effed51 100644
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2009-2010 B.A.T.M.A.N. contributors:
  *
  * Andrew Lunn <[email protected]>
@@ -19,5 +19,5 @@
  *
  */
 
-int vis_data(int argc, char * argv[]);
+int vis_data(char *mesh_iface, int argc, char * argv[]);
 
Signature · 1 line
1.7.0.4