summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/types.h
diff options
context:
space:
mode:
authorAntonio Quartulli2012-06-30 20:01:19 +0200
committerAntonio Quartulli2012-11-07 20:00:20 +0100
commit2f1dfbe185075a50dc8f0490a136377af53a1c62 (patch)
tree45ade201ca4b63e4409fc21567db0f750abc8bc7 /net/batman-adv/types.h
parentbatman-adv: Distributed ARP Table - create DHT helper functions (diff)
downloadkernel-qcow2-linux-2f1dfbe185075a50dc8f0490a136377af53a1c62.tar.gz
kernel-qcow2-linux-2f1dfbe185075a50dc8f0490a136377af53a1c62.tar.xz
kernel-qcow2-linux-2f1dfbe185075a50dc8f0490a136377af53a1c62.zip
batman-adv: Distributed ARP Table - implement local storage
Since batman-adv cannot inter-operate with the host ARP table, this patch introduces a batman-adv private storage for ARP entries exchanged within DAT. This storage will represent the node local cache in the DAT protocol. Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/types.h')
-rw-r--r--net/batman-adv/types.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index b57d93bdafa6..9ed1bb275d31 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -249,9 +249,13 @@ struct batadv_priv_vis {
/**
* struct batadv_priv_dat - per mesh interface DAT private data
* @addr: node DAT address
+ * @hash: hashtable representing the local ARP cache
+ * @work: work queue callback item for cache purging
*/
struct batadv_priv_dat {
batadv_dat_addr_t addr;
+ struct batadv_hashtable *hash;
+ struct delayed_work work;
};
struct batadv_priv {
@@ -465,6 +469,25 @@ struct batadv_algo_ops {
};
/**
+ * struct batadv_dat_entry - it is a single entry of batman-adv ARP backend. It
+ * is used to stored ARP entries needed for the global DAT cache
+ * @ip: the IPv4 corresponding to this DAT/ARP entry
+ * @mac_addr: the MAC address associated to the stored IPv4
+ * @last_update: time in jiffies when this entry was refreshed last time
+ * @hash_entry: hlist node for batadv_priv_dat::hash
+ * @refcount: number of contexts the object is used
+ * @rcu: struct used for freeing in an RCU-safe manner
+ */
+struct batadv_dat_entry {
+ __be32 ip;
+ uint8_t mac_addr[ETH_ALEN];
+ unsigned long last_update;
+ struct hlist_node hash_entry;
+ atomic_t refcount;
+ struct rcu_head rcu;
+};
+
+/**
* struct batadv_dat_candidate - candidate destination for DAT operations
* @type: the type of the selected candidate. It can one of the following:
* - BATADV_DAT_CANDIDATE_NOT_FOUND