From patchwork Wed Apr 24 05:16:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YourName X-Patchwork-Id: 2986 Return-Path: Received: from mail-ea0-f181.google.com (mail-ea0-f181.google.com [209.85.215.181]) by open-mesh.org (Postfix) with ESMTPS id AFF93600E75 for ; Wed, 24 Apr 2013 07:18:23 +0200 (CEST) Received: by mail-ea0-f181.google.com with SMTP id a11so527239eae.26 for ; Tue, 23 Apr 2013 22:18:23 -0700 (PDT) X-Received: by 10.15.93.202 with SMTP id w50mr35408267eez.45.1366780703355; Tue, 23 Apr 2013 22:18:23 -0700 (PDT) Received: from localhost.localdomain ([188.26.80.190]) by mx.google.com with ESMTPSA id i53sm1576202eeu.5.2013.04.23.22.18.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Apr 2013 22:18:22 -0700 (PDT) From: Mihail To: b.a.t.m.a.n@lists.open-mesh.org Date: Wed, 24 Apr 2013 08:16:39 +0300 Message-Id: <1366780600-5030-1-git-send-email-mihail.costea2005@gmail.com> X-Mailer: git-send-email 1.7.10.4 Subject: [B.A.T.M.A.N.] [PATCH 0/1] Added type field to dat_entry in order to generalize the DAT X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2013 05:18:24 -0000 Signed-off-by: Mihail Costea Signed-off-by: Stefan Popa Reviewed-by: Stefan Popa --- 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(+) diff --git a/distributed-arp-table.c b/distributed-arp-table.c index 3a3e1d8..2cb5ebb 100644 --- a/distributed-arp-table.c +++ b/distributed-arp-table.c @@ -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); diff --git a/types.h b/types.h index b2c94e1..0807ef9 100644 --- a/types.h +++ b/types.h @@ -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