From patchwork Mon Jul 8 00:12:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YourName X-Patchwork-Id: 3194 Return-Path: Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by open-mesh.org (Postfix) with ESMTPS id 04E856021A3 for ; Mon, 8 Jul 2013 02:13:56 +0200 (CEST) Received: by mail-pd0-f177.google.com with SMTP id p10so3507391pdj.22 for ; Sun, 07 Jul 2013 17:13:54 -0700 (PDT) X-Received: by 10.66.171.231 with SMTP id ax7mr20244857pac.32.1373242434946; Sun, 07 Jul 2013 17:13:54 -0700 (PDT) Received: from localhost.localdomain (c-76-103-209-113.hsd1.ca.comcast.net. [76.103.209.113]) by mx.google.com with ESMTPSA id td4sm20607539pac.20.2013.07.07.17.13.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 07 Jul 2013 17:13:54 -0700 (PDT) From: mihail.costea2005@gmail.com To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 8 Jul 2013 03:12:42 +0300 Message-Id: <1373242365-763-3-git-send-email-mihail.costea2005@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1373242365-763-1-git-send-email-mihail.costea2005@gmail.com> References: <1373242365-763-1-git-send-email-mihail.costea2005@gmail.com> Subject: [B.A.T.M.A.N.] [RFC 3/6] batman-adv: Adds IPv6 to DAT and generic struct in distributed-arp-table.c 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: Mon, 08 Jul 2013 00:13:57 -0000 From: Mihail Costea Adds IPv6 functionality to the generic struct. Signed-off-by: Mihail Costea Signed-off-by: Stefan Popa Reviewed-by: Stefan Popa --- distributed-arp-table.c | 12 +++++++++--- distributed-arp-table.h | 2 +- types.h | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/distributed-arp-table.c b/distributed-arp-table.c index b2a4fe5..f941913 100644 --- a/distributed-arp-table.c +++ b/distributed-arp-table.c @@ -36,6 +36,12 @@ static struct batadv_dat_type_info batadv_dat_types_info[] = { .size = sizeof(__be32), .str_fmt = "%pI4", }, +#if IS_ENABLED(CONFIG_IPV6) + { + .size = sizeof(struct in6_addr), + .str_fmt = "%pI6c", + }, +#endif }; static void batadv_dat_purge(struct work_struct *work); @@ -845,8 +851,8 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset) goto out; seq_printf(seq, "Distributed ARP Table (%s):\n", net_dev->name); - seq_printf(seq, " %-7s %-13s %5s\n", "IPv4", "MAC", - "last-seen"); + seq_printf(seq, " %-26s %-15s %5s\n", + "IPv4/IPv6", "MAC", "last-seen"); for (i = 0; i < hash->size; i++) { head = &hash->table[i]; @@ -859,7 +865,7 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset) last_seen_msecs = last_seen_msecs % 60000; last_seen_secs = last_seen_msecs / 1000; - seq_printf(seq, " * %15s %14pM %6i:%02i\n", + seq_printf(seq, " * %40s %15pM %6i:%02i\n", batadv_dat_data_to_str(dat_entry->data, dat_entry->type, dbg_data, diff --git a/distributed-arp-table.h b/distributed-arp-table.h index 21d7b24..d029b4b 100644 --- a/distributed-arp-table.h +++ b/distributed-arp-table.h @@ -28,7 +28,7 @@ #include #define BATADV_DAT_ADDR_MAX ((batadv_dat_addr_t)~(batadv_dat_addr_t)0) -#define BATADV_DAT_DATA_MAX_LEN 16 +#define BATADV_DAT_DATA_MAX_LEN 40 void batadv_dat_status_update(struct net_device *net_dev); bool batadv_dat_snoop_outgoing_pkt_request(struct batadv_priv *bat_priv, diff --git a/types.h b/types.h index 69c187e..60d2d64 100644 --- a/types.h +++ b/types.h @@ -953,10 +953,14 @@ struct batadv_dat_entry { /** * batadv_dat_types - types used in batadv_dat_entry for IP - * @BATADV_DAT_IPv4: IPv4 address type + * @BATADV_DAT_IPV4: IPv4 address type + * @BATADV_DAT_IPV6: IPv6 address type */ enum batadv_dat_types { BATADV_DAT_IPV4 = 0, +#if IS_ENABLED(CONFIG_IPV6) + BATADV_DAT_IPV6 = 1, +#endif }; /**