2 * Routines for AODV dissection
3 * Copyright 2000, Erik Nordström <erik.nordstrom@it.uu.se>
5 * $Id: packet-aodv.c,v 1.7 2003/04/30 23:21:19 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 #include <epan/int-64bit.h>
38 #include <epan/packet.h>
39 #include <epan/ipv6-utils.h>
42 #define offsetof(type, member) ((size_t)(&((type *)0)->member))
48 * http://www.ietf.org/internet-drafts/draft-ietf-manet-aodv-13.txt
50 * http://www.cs.ucsb.edu/~ebelding/txt/aodv6.txt
52 * http://www.tcs.hut.fi/~anttit/manet/drafts/draft-perkins-aodv6-01.txt
55 #define INET6_ADDRLEN 16
56 #define UDP_PORT_AODV 654
65 #define V6_RREP_ACK 19
69 #define AODV6_EXT_INT 2
70 #define AODV6_EXT_NTP 3
73 #define RREQ_GRAT 0x20
75 #define RREQ_JOIN 0x80
80 #define RERR_NODEL 0x80
82 static const value_string type_vals[] = {
83 { RREQ, "Route Request" },
84 { RREP, "Route Reply" },
85 { RERR, "Route Error" },
86 { V6_RREQ, "IPv6 Route Request"},
87 { V6_RREP, "IPv6 Route Reply"},
88 { V6_RERR, "IPv6 Route Error"},
89 { V6_RREP_ACK, "IPv6 Route Reply Acknowledgment"},
93 static const value_string exttype_vals[] = {
95 { AODV6_EXT_INT, "Hello Interval"},
96 { AODV6_EXT_NTP, "Timestamp"},
132 typedef struct v6_rreq {
140 struct e_in6_addr dest_addr;
141 struct e_in6_addr orig_addr;
144 typedef struct v6_rrep {
150 struct e_in6_addr dest_addr;
151 struct e_in6_addr orig_addr;
155 typedef struct v6_rerr {
161 struct e_in6_addr dest_addr;
164 typedef struct v6_rrep_ack {
169 typedef struct v6_ext {
174 /* Initialize the protocol and registered fields */
175 static int proto_aodv = -1;
176 static int hf_aodv_type = -1;
177 static int hf_aodv_flags = -1;
178 static int hf_aodv_prefix_sz = -1;
179 static int hf_aodv_hopcount = -1;
180 static int hf_aodv_rreq_id = -1;
181 static int hf_aodv_dest_ip = -1;
182 static int hf_aodv_dest_ipv6 = -1;
183 static int hf_aodv_dest_seqno = -1;
184 static int hf_aodv_orig_ip = -1;
185 static int hf_aodv_orig_ipv6 = -1;
186 static int hf_aodv_orig_seqno = -1;
187 static int hf_aodv_lifetime = -1;
188 static int hf_aodv_destcount = -1;
189 static int hf_aodv_unreach_dest_ip = -1;
190 static int hf_aodv_unreach_dest_ipv6 = -1;
191 static int hf_aodv_unreach_dest_seqno = -1;
192 static int hf_aodv_flags_rreq_join = -1;
193 static int hf_aodv_flags_rreq_repair = -1;
194 static int hf_aodv_flags_rreq_gratuitous = -1;
195 static int hf_aodv_flags_rrep_repair = -1;
196 static int hf_aodv_flags_rrep_ack = -1;
197 static int hf_aodv_flags_rerr_nodelete = -1;
198 static int hf_aodv_ext_type = -1;
199 static int hf_aodv_ext_length = -1;
200 static int hf_aodv_ext_interval = -1;
201 static int hf_aodv_ext_timestamp = -1;
203 /* Initialize the subtree pointers */
204 static gint ett_aodv = -1;
205 static gint ett_aodv_flags = -1;
206 static gint ett_aodv_unreach_dest = -1;
207 static gint ett_aodv_extensions = -1;
209 /* Code to actually dissect the packets */
212 dissect_aodv6_ext(tvbuff_t * tvb, int offset, proto_tree * tree)
214 proto_tree *aodv6ext_tree;
216 v6_ext_t aodv6ext, *ext;
224 if ((int) tvb_reported_length(tvb) <= offset)
225 return; /* No more options left */
228 tvb_memcpy(tvb, (guint8 *) ext, offset, sizeof(*ext));
231 ti = proto_tree_add_text(tree, tvb, offset, sizeof(v6_ext_t) +
232 len, "AODV6 Extensions");
233 aodv6ext_tree = proto_item_add_subtree(ti, ett_aodv_extensions);
236 proto_tree_add_text(aodv6ext_tree, tvb,
237 offset + offsetof(v6_ext_t, length), 1,
238 "Invalid option length: %u", ext->length);
239 return; /* we must not try to decode this */
244 typename = "Hello Interval";
247 typename = "Timestamp";
250 typename = "Unknown";
253 proto_tree_add_text(aodv6ext_tree, tvb,
254 offset + offsetof(v6_ext_t, type), 1,
255 "Type: %u (%s)", ext->type, typename);
256 proto_tree_add_text(aodv6ext_tree, tvb,
257 offset + offsetof(v6_ext_t, length), 1,
258 "Length: %u bytes", ext->length);
260 offset += sizeof(v6_ext_t);
264 proto_tree_add_uint(aodv6ext_tree, hf_aodv_ext_interval,
265 tvb, offset, 4, tvb_get_ntohl(tvb, offset));
268 proto_tree_add_item(aodv6ext_tree, hf_aodv_ext_timestamp,
269 tvb, offset, 8, FALSE);
274 /* If multifield extensions appear, we need more
275 * sophisticated handler. For now, this is okay. */
277 offset += ext->length;
282 dissect_aodv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
284 proto_item *ti = NULL, *tj = NULL, *tk = NULL;
285 proto_tree *aodv_tree = NULL, *aodv_flags_tree = NULL,
286 *aodv_unreach_dest_tree = NULL;
290 struct aodv_rreq rreq;
291 struct aodv_rrep rrep;
292 struct aodv_rerr rerr;
297 /* Make entries in Protocol column and Info column on summary display */
298 if (check_col(pinfo->cinfo, COL_PROTOCOL))
299 col_set_str(pinfo->cinfo, COL_PROTOCOL, "AODV");
301 if (check_col(pinfo->cinfo, COL_INFO))
302 col_clear(pinfo->cinfo, COL_INFO);
304 /* Check the type of AODV packet. */
305 type = tvb_get_guint8(tvb, 0);
306 if (match_strval(type, type_vals) == NULL) {
308 * We assume this is not an AODV packet.
314 ti = proto_tree_add_protocol_format(tree, proto_aodv, tvb, 0, -1,
315 "Ad hoc On-demand Distance Vector Routing Protocol, %s",
316 val_to_str(type, type_vals, "Unknown AODV Packet Type (%u)"));
317 aodv_tree = proto_item_add_subtree(ti, ett_aodv);
319 proto_tree_add_uint(aodv_tree, hf_aodv_type, tvb, 0, 1, type);
320 tj = proto_tree_add_text(aodv_tree, tvb, 1, 1, "Flags:");
321 aodv_flags_tree = proto_item_add_subtree(tj, ett_aodv_flags);
327 flags = tvb_get_guint8(tvb, 1);
328 rreq.hop_count = tvb_get_guint8(tvb, 3);
329 rreq.rreq_id = tvb_get_ntohl(tvb, 4);
330 tvb_memcpy(tvb, (guint8 *)&rreq.dest_addr, 8, 4);
331 rreq.dest_seqno = tvb_get_ntohl(tvb, 12);
332 tvb_memcpy(tvb, (guint8 *)&rreq.orig_addr, 16, 4);
333 rreq.orig_seqno = tvb_get_ntohl(tvb, 20);
336 proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_join, tvb, 1, 1, flags);
337 proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_repair, tvb, 1, 1, flags);
338 proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rreq_gratuitous, tvb, 1, 1, flags);
339 if (flags & RREQ_JOIN)
340 proto_item_append_text(tj, " J");
341 if (flags & RREQ_REP)
342 proto_item_append_text(tj, " R");
343 if (flags & RREQ_GRAT)
344 proto_item_append_text(tj, " G");
345 proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb, 3, 1, rreq.hop_count);
346 proto_tree_add_uint(aodv_tree, hf_aodv_rreq_id, tvb, 4, 4, rreq.rreq_id);
347 proto_tree_add_ipv4(aodv_tree, hf_aodv_dest_ip, tvb, 8, 4, rreq.dest_addr);
348 proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb, 12, 4, rreq.dest_seqno);
349 proto_tree_add_ipv4(aodv_tree, hf_aodv_orig_ip, tvb, 16, 4, rreq.orig_addr);
350 proto_tree_add_uint(aodv_tree, hf_aodv_orig_seqno, tvb, 20, 4, rreq.orig_seqno);
351 proto_item_append_text(ti, ", Dest IP: %s, Orig IP: %s, Id=%u", ip_to_str(tvb_get_ptr(tvb, 8, 4)), ip_to_str(tvb_get_ptr(tvb, 16, 4)), rreq.rreq_id);
354 if (check_col(pinfo->cinfo, COL_INFO))
355 col_add_fstr(pinfo->cinfo, COL_INFO, "%s, D: %s O: %s Id=%u Hcnt=%u DSN=%u OSN=%u",
356 val_to_str(type, type_vals,
357 "Unknown AODV Packet Type (%u)"),
358 ip_to_str(tvb_get_ptr(tvb, 8, 4)),
359 ip_to_str(tvb_get_ptr(tvb, 16, 4)),
367 flags = tvb_get_guint8(tvb, 1);
368 rrep.prefix_sz = tvb_get_guint8(tvb, 2) & 0x1F;
369 rrep.hop_count = tvb_get_guint8(tvb, 3);
370 tvb_memcpy(tvb, (guint8 *)&rrep.dest_addr, 4, 4);
371 rrep.dest_seqno = tvb_get_ntohl(tvb, 8);
372 tvb_memcpy(tvb, (guint8 *)&rrep.orig_addr, 12, 4);
373 rrep.lifetime = tvb_get_ntohl(tvb, 16);
376 proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rrep_repair, tvb, 1, 1, flags);
377 proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rrep_ack, tvb, 1, 1, flags);
378 if (flags & RREP_REP)
379 proto_item_append_text(tj, " R");
380 if (flags & RREP_ACK)
381 proto_item_append_text(tj, " A");
382 proto_tree_add_uint(aodv_tree, hf_aodv_prefix_sz, tvb, 3, 1, rrep.prefix_sz);
383 proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb, 3, 1, rrep.hop_count);
384 proto_tree_add_ipv4(aodv_tree, hf_aodv_dest_ip, tvb, 4, 4, rrep.dest_addr);
385 proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb, 8, 4, rrep.dest_seqno);
386 proto_tree_add_ipv4(aodv_tree, hf_aodv_orig_ip, tvb, 12, 4, rrep.orig_addr);
387 proto_tree_add_uint(aodv_tree, hf_aodv_lifetime, tvb, 16, 4, rrep.lifetime);
388 proto_item_append_text(ti, ", Dest IP: %s, Orig IP: %s, Lifetime=%u", ip_to_str(tvb_get_ptr(tvb, 4, 4)), ip_to_str(tvb_get_ptr(tvb, 12, 4)), rrep.lifetime);
391 if (check_col(pinfo->cinfo, COL_INFO))
392 col_add_fstr(pinfo->cinfo, COL_INFO, "%s D: %s O: %s Hcnt=%u DSN=%u Lifetime=%u",
393 val_to_str(type, type_vals,
394 "Unknown AODV Packet Type (%u)"),
395 ip_to_str(tvb_get_ptr(tvb, 4, 4)),
396 ip_to_str(tvb_get_ptr(tvb, 12, 4)),
402 flags = tvb_get_guint8(tvb, 1);
403 rerr.dest_count = tvb_get_guint8(tvb, 3);
406 proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rerr_nodelete, tvb, 1, 1, flags);
407 if (flags & RERR_NODEL)
408 proto_item_append_text(tj, " N");
409 proto_tree_add_uint(aodv_tree, hf_aodv_destcount, tvb, 3, 1, rerr.dest_count);
410 tk = proto_tree_add_text(aodv_tree, tvb, 4, 8*rerr.dest_count, "Unreachable Destinations:");
412 aodv_unreach_dest_tree = proto_item_add_subtree(tk, ett_aodv_unreach_dest);
413 for (i = 0; i < rerr.dest_count; i++) {
414 tvb_memcpy(tvb, (guint8 *)&rerr.dest_addr, 4+8*i, 4);
415 rerr.dest_seqno = tvb_get_ntohl(tvb, 8+8*i);
416 proto_tree_add_ipv4(aodv_unreach_dest_tree, hf_aodv_dest_ip, tvb, 4+8*i, 4, rerr.dest_addr);
417 proto_tree_add_uint(aodv_unreach_dest_tree, hf_aodv_dest_seqno, tvb, 8+8*i, 4, rerr.dest_seqno);
421 if (check_col(pinfo->cinfo, COL_INFO))
422 col_add_fstr(pinfo->cinfo, COL_INFO, "%s, Dest Count=%u",
423 val_to_str(type, type_vals,
424 "Unknown AODV Packet Type (%u)"),
428 flags = tvb_get_guint8(tvb, offsetof(v6_rreq_t, flags));
429 v6_rreq.hop_count = tvb_get_guint8(tvb, offsetof(v6_rreq_t, hop_count));
430 v6_rreq.rreq_id = tvb_get_ntohl(tvb, offsetof(v6_rreq_t, rreq_id));
431 v6_rreq.dest_seqno = tvb_get_ntohl(tvb, offsetof(v6_rreq_t, dest_seqno));
432 v6_rreq.orig_seqno = tvb_get_ntohl(tvb, offsetof(v6_rreq_t, orig_seqno));
433 tvb_memcpy(tvb, (guint8 *) & v6_rreq.dest_addr,
434 offsetof(v6_rreq_t, dest_addr), INET6_ADDRLEN);
435 tvb_memcpy(tvb, (guint8 *) & v6_rreq.orig_addr,
436 offsetof(v6_rreq_t, orig_addr), INET6_ADDRLEN);
439 proto_tree_add_boolean(aodv_flags_tree,
440 hf_aodv_flags_rreq_join, tvb,
441 offsetof(v6_rreq_t, flags), 1, flags);
442 proto_tree_add_boolean(aodv_flags_tree,
443 hf_aodv_flags_rreq_repair, tvb,
444 offsetof(v6_rreq_t, flags), 1, flags);
445 proto_tree_add_boolean(aodv_flags_tree,
446 hf_aodv_flags_rreq_gratuitous, tvb,
447 offsetof(v6_rreq_t, flags), 1, flags);
448 if (flags & RREQ_JOIN)
449 proto_item_append_text(tj, " J");
450 if (flags & RREQ_REP)
451 proto_item_append_text(tj, " R");
452 if (flags & RREQ_GRAT)
453 proto_item_append_text(tj, " G");
454 proto_tree_add_uint(aodv_tree, hf_aodv_hopcount, tvb,
455 offsetof(v6_rreq_t, hop_count), 1,
457 proto_tree_add_uint(aodv_tree, hf_aodv_rreq_id, tvb,
458 offsetof(v6_rreq_t, rreq_id), 4,
460 proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno, tvb,
461 offsetof(v6_rreq_t, dest_seqno), 4,
463 proto_tree_add_uint(aodv_tree, hf_aodv_orig_seqno, tvb,
464 offsetof(v6_rreq_t, orig_seqno), 4,
466 proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6, tvb,
467 offsetof(v6_rreq_t, dest_addr),
469 (guint8 *) & v6_rreq.dest_addr);
470 proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb,
471 offsetof(v6_rreq_t, orig_addr),
473 (guint8 *) & v6_rreq.orig_addr);
474 proto_item_append_text(ti,
475 ", Dest IP: %s, Orig IP: %s, Id=%u",
476 ip6_to_str(&v6_rreq.dest_addr),
477 ip6_to_str(&v6_rreq.orig_addr),
479 extlen = ((int) tvb_reported_length(tvb) - sizeof(v6_rreq_t));
481 dissect_aodv6_ext(tvb, sizeof(v6_rreq_t), aodv_tree);
485 if (check_col(pinfo->cinfo, COL_INFO))
486 col_add_fstr(pinfo->cinfo, COL_INFO,
487 "%s, D: %s O: %s Id=%u Hcnt=%u DSN=%u OSN=%u",
488 val_to_str(type, type_vals,
489 "Unknown AODV Packet Type (%u)"),
490 ip6_to_str(&v6_rreq.dest_addr),
491 ip6_to_str(&v6_rreq.orig_addr),
493 v6_rreq.hop_count, v6_rreq.dest_seqno, v6_rreq.orig_seqno);
496 flags = tvb_get_guint8(tvb, offsetof(v6_rrep_t, flags));
497 v6_rrep.prefix_sz = tvb_get_guint8(tvb, offsetof(v6_rrep_t, prefix_sz)) & 0x1F;
498 v6_rrep.hop_count = tvb_get_guint8(tvb, offsetof(v6_rrep_t, hop_count));
499 v6_rrep.dest_seqno = tvb_get_ntohl(tvb, offsetof(v6_rrep_t, dest_seqno));
500 tvb_memcpy(tvb, (guint8 *) & v6_rrep.dest_addr,
501 offsetof(v6_rrep_t, dest_addr), INET6_ADDRLEN);
502 tvb_memcpy(tvb, (guint8 *) & v6_rrep.orig_addr,
503 offsetof(v6_rrep_t, orig_addr), INET6_ADDRLEN);
504 v6_rrep.lifetime = tvb_get_ntohl(tvb, offsetof(v6_rrep_t, lifetime));
507 proto_tree_add_boolean(aodv_flags_tree,
508 hf_aodv_flags_rrep_repair, tvb,
509 offsetof(v6_rrep_t, flags), 1, flags);
510 proto_tree_add_boolean(aodv_flags_tree,
511 hf_aodv_flags_rrep_ack, tvb,
512 offsetof(v6_rrep_t, flags), 1, flags);
513 if (flags & RREP_REP)
514 proto_item_append_text(tj, " R");
515 if (flags & RREP_ACK)
516 proto_item_append_text(tj, " A");
517 proto_tree_add_uint(aodv_tree, hf_aodv_prefix_sz,
518 tvb, offsetof(v6_rrep_t, prefix_sz), 1,
520 proto_tree_add_uint(aodv_tree, hf_aodv_hopcount,
521 tvb, offsetof(v6_rrep_t, hop_count), 1,
523 proto_tree_add_uint(aodv_tree, hf_aodv_dest_seqno,
524 tvb, offsetof(v6_rrep_t, dest_seqno), 4,
526 proto_tree_add_ipv6(aodv_tree, hf_aodv_dest_ipv6,
527 tvb, offsetof(v6_rrep_t, dest_addr),
529 (guint8 *) & v6_rrep.dest_addr);
530 proto_tree_add_ipv6(aodv_tree, hf_aodv_orig_ipv6, tvb,
531 offsetof(v6_rrep_t, orig_addr),
533 (guint8 *) & v6_rrep.orig_addr);
534 proto_tree_add_uint(aodv_tree, hf_aodv_lifetime, tvb,
535 offsetof(v6_rrep_t, lifetime), 4,
537 proto_item_append_text(ti,
538 ", Dest IP: %s, Orig IP: %s, Lifetime=%u",
539 ip6_to_str(&v6_rrep.dest_addr),
540 ip6_to_str(&v6_rrep.orig_addr),
542 extlen = ((int) tvb_reported_length(tvb) - sizeof(v6_rrep_t));
544 dissect_aodv6_ext(tvb, sizeof(v6_rrep_t), aodv_tree);
548 if (check_col(pinfo->cinfo, COL_INFO))
549 col_add_fstr(pinfo->cinfo, COL_INFO,
550 "%s D: %s O: %s Hcnt=%u DSN=%u Lifetime=%u",
551 val_to_str(type, type_vals,
552 "Unknown AODV Packet Type (%u)"),
553 ip6_to_str(&v6_rrep.dest_addr),
554 ip6_to_str(&v6_rrep.orig_addr),
555 v6_rrep.hop_count, v6_rrep.dest_seqno, v6_rrep.lifetime);
558 flags = tvb_get_guint8(tvb, offsetof(v6_rerr_t, flags));
560 tvb_get_guint8(tvb, offsetof(v6_rerr_t, dest_count));
563 proto_tree_add_boolean(aodv_flags_tree,
564 hf_aodv_flags_rerr_nodelete, tvb,
565 offsetof(v6_rerr_t, flags), 1, flags);
566 if (flags & RERR_NODEL)
567 proto_item_append_text(tj, " N");
568 proto_tree_add_uint(aodv_tree, hf_aodv_destcount, tvb,
569 offsetof(v6_rerr_t, dest_count), 1,
571 tk = proto_tree_add_text(aodv_tree, tvb,
572 offsetof(v6_rerr_t, dest_addr),
574 INET6_ADDRLEN) * v6_rerr.dest_count,
575 "Unreachable Destinations");
577 aodv_unreach_dest_tree =
578 proto_item_add_subtree(tk, ett_aodv_unreach_dest);
579 for (i = 0; i < v6_rerr.dest_count; i++) {
581 tvb_get_ntohl(tvb, offsetof(v6_rerr_t, dest_seqno)
582 + (4 + INET6_ADDRLEN) * i);
583 tvb_memcpy(tvb, (guint8 *) & v6_rerr.dest_addr,
584 offsetof(v6_rerr_t, dest_addr)
585 + (4 + INET6_ADDRLEN) * i, INET6_ADDRLEN);
586 proto_tree_add_uint(aodv_unreach_dest_tree,
587 hf_aodv_dest_seqno, tvb,
588 offsetof(v6_rerr_t, dest_seqno)
589 + (4 + INET6_ADDRLEN) * i, 4,
591 proto_tree_add_ipv6(aodv_unreach_dest_tree,
592 hf_aodv_unreach_dest_ipv6, tvb,
593 offsetof(v6_rerr_t, dest_addr)
594 + (4 + INET6_ADDRLEN) * i,
596 (guint8 *) & v6_rerr.dest_addr);
600 if (check_col(pinfo->cinfo, COL_INFO))
601 col_add_fstr(pinfo->cinfo, COL_INFO,
603 val_to_str(type, type_vals,
604 "Unknown AODV Packet Type (%u)"),
608 if (check_col(pinfo->cinfo, COL_INFO))
609 col_add_fstr(pinfo->cinfo, COL_INFO, "%s",
610 val_to_str(type, type_vals,
611 "Unknown AODV Packet Type (%u)"));
614 proto_tree_add_text(aodv_tree, tvb, 0,
615 1, "Unknown AODV Packet Type (%u)",
619 return tvb_length(tvb);
623 /* Register the protocol with Ethereal */
625 proto_register_aodv(void)
627 static hf_register_info hf[] = {
629 { "Type", "aodv.type",
630 FT_UINT8, BASE_DEC, VALS(type_vals), 0x0,
631 "AODV packet type", HFILL }
634 { "Flags", "aodv.flags",
635 FT_UINT16, BASE_DEC, NULL, 0x0,
638 { &hf_aodv_flags_rreq_join,
639 { "RREQ Join", "aodv.flags.rreq_join",
640 FT_BOOLEAN, 8, TFS(&flags_set_truth), RREQ_JOIN,
643 { &hf_aodv_flags_rreq_repair,
644 { "RREQ Repair", "aodv.flags.rreq_repair",
645 FT_BOOLEAN, 8, TFS(&flags_set_truth), RREQ_REP,
648 { &hf_aodv_flags_rreq_gratuitous,
649 { "RREQ Gratuitous", "aodv.flags.rreq_gratuitous",
650 FT_BOOLEAN, 8, TFS(&flags_set_truth), RREQ_GRAT,
653 { &hf_aodv_flags_rrep_repair,
654 { "RREP Repair", "aodv.flags.rrep_repair",
655 FT_BOOLEAN, 8, TFS(&flags_set_truth), RREP_REP,
658 { &hf_aodv_flags_rrep_ack,
659 { "RREP Acknowledgement", "aodv.flags.rrep_ack",
660 FT_BOOLEAN, 8, TFS(&flags_set_truth), RREP_ACK,
663 { &hf_aodv_flags_rerr_nodelete,
664 { "RERR No Delete", "aodv.flags.rerr_nodelete",
665 FT_BOOLEAN, 8, TFS(&flags_set_truth), RERR_NODEL,
668 { &hf_aodv_prefix_sz,
669 { "Prefix Size", "aodv.prefix_sz",
670 FT_UINT8, BASE_DEC, NULL, 0x0,
671 "Prefix Size", HFILL }
674 { "Hop Count", "aodv.hopcount",
675 FT_UINT8, BASE_DEC, NULL, 0x0,
679 { "RREQ Id", "aodv.rreq_id",
680 FT_UINT32, BASE_DEC, NULL, 0x0,
684 { "Destination IP", "aodv.dest_ip",
685 FT_IPv4, BASE_NONE, NULL, 0x0,
686 "Destination IP Address", HFILL }
688 { &hf_aodv_dest_ipv6,
689 { "Destination IPv6", "aodv.dest_ipv6",
690 FT_IPv6, BASE_NONE, NULL, 0x0,
691 "Destination IPv6 Address", HFILL}
693 { &hf_aodv_dest_seqno,
694 { "Destination Sequence Number", "aodv.dest_seqno",
695 FT_UINT32, BASE_DEC, NULL, 0x0,
696 "Destination Sequence Number", HFILL }
699 { "Originator IP", "aodv.orig_ip",
700 FT_IPv4, BASE_NONE, NULL, 0x0,
701 "Originator IP Address", HFILL }
703 { &hf_aodv_orig_ipv6,
704 { "Originator IPv6", "aodv.orig_ipv6",
705 FT_IPv6, BASE_NONE, NULL, 0x0,
706 "Originator IPv6 Address", HFILL}
708 { &hf_aodv_orig_seqno,
709 { "Originator Sequence Number", "aodv.orig_seqno",
710 FT_UINT32, BASE_DEC, NULL, 0x0,
711 "Originator Sequence Number", HFILL }
714 { "Lifetime", "aodv.lifetime",
715 FT_UINT32, BASE_DEC, NULL, 0x0,
718 { &hf_aodv_destcount,
719 { "Destination Count", "aodv.destcount",
720 FT_UINT8, BASE_DEC, NULL, 0x0,
721 "Unreachable Destinations Count", HFILL }
723 { &hf_aodv_unreach_dest_ip,
724 { "Unreachable Destination IP", "aodv.unreach_dest_ip",
725 FT_IPv4, BASE_NONE, NULL, 0x0,
726 "Unreachable Destination IP Address", HFILL }
728 { &hf_aodv_unreach_dest_ipv6,
729 { "Unreachable Destination IPv6", "aodv.unreach_dest_ipv6",
730 FT_IPv6, BASE_NONE, NULL, 0x0,
731 "Unreachable Destination IPv6 Address", HFILL}
733 { &hf_aodv_unreach_dest_seqno,
734 { "Unreachable Destination Sequence Number", "aodv.unreach_dest_seqno",
735 FT_UINT32, BASE_DEC, NULL, 0x0,
736 "Unreachable Destination Sequence Number", HFILL }
739 { "Extension Type", "aodv.ext_type",
740 FT_UINT8, BASE_DEC, NULL, 0x0,
741 "Extension Format Type", HFILL}
743 { &hf_aodv_ext_length,
744 { "Extension Length", "aodv.ext_length",
745 FT_UINT8, BASE_DEC, NULL, 0x0,
746 "Extension Data Length", HFILL}
748 { &hf_aodv_ext_interval,
749 { "Hello Interval", "aodv.hello_interval",
750 FT_UINT32, BASE_DEC, NULL, 0x0,
751 "Hello Interval Extension", HFILL}
753 { &hf_aodv_ext_timestamp,
754 { "Timestamp", "aodv.timestamp",
755 FT_UINT64, BASE_DEC, NULL, 0x0,
756 "Timestamp Extension", HFILL}
760 /* Setup protocol subtree array */
761 static gint *ett[] = {
764 &ett_aodv_unreach_dest,
765 &ett_aodv_extensions,
768 /* Register the protocol name and description */
769 proto_aodv = proto_register_protocol("Ad hoc On-demand Distance Vector Routing Protocol", "AODV", "aodv");
771 /* Required function calls to register the header fields and subtrees used */
772 proto_register_field_array(proto_aodv, hf, array_length(hf));
773 proto_register_subtree_array(ett, array_length(ett));
778 proto_reg_handoff_aodv(void)
780 dissector_handle_t aodv_handle;
782 aodv_handle = new_create_dissector_handle(dissect_aodv,
784 dissector_add("udp.port", UDP_PORT_AODV, aodv_handle);