Skip to contentSkip to conversation

Added type field to dat_entry in order to generalize the DAT

PATCH New Mihail 1 participant 1 message Apr 24, 2013

lore
Share & tools
lore

Mihail

author
#0 lore raw

cover Added type field to dat_entry in order to generalize the DAT

---

This change is needed in order to make DAT support any type of data, like IPv6 too. Types are going to be added to batadv_dat_types enum.

 distributed-arp-table.c |    1 +
 types.h                 |   11 +++++++++++
 2 files changed, 12 insertions(+)
distributed-arp-table.c +1 -0
index 3a3e1d8..2cb5ebb 100644
@@ -290,6 +290,7 @@ static void batadv_dat_entry_add(struct batadv_priv *bat_priv, __be32 ip,
 		goto out;
 
 	dat_entry->ip = ip;
+	dat_entry->type = BATADV_DAT_IPV4;
 	memcpy(dat_entry->mac_addr, mac_addr, ETH_ALEN);
 	dat_entry->last_update = jiffies;
 	atomic_set(&dat_entry->refcount, 2);
types.h +11 -0
index b2c94e1..0807ef9 100644
@@ -964,6 +964,7 @@ 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
+ * @type: the type corresponding to this DAT 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
@@ -972,6 +973,7 @@ struct batadv_algo_ops {
  */
 struct batadv_dat_entry {
 	__be32 ip;
+	uint8_t type;
 	uint8_t mac_addr[ETH_ALEN];
 	unsigned long last_update;
 	struct hlist_node hash_entry;
@@ -980,6 +982,15 @@ struct batadv_dat_entry {
 };
 
 /**
+ * batadv_dat_types - types used in batadv_dat_entry for IP
+ * @BATADV_DAT_IPv4: IPv4 address type
+ * @BATADV_DAT_IPv6: IPv6 address type
+ */
+enum batadv_dat_types {
+	BATADV_DAT_IPV4 = 0,
+};
+
+/**
  * 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
Signature · 1 line
1.7.10.4