Ethereal-dev: [Ethereal-dev] Patch: DNSSSEC OK/DO bit (RFC 3225) support in packet-dns.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Yaniv Kaul <ykaul@xxxxxxxxxxxxxx>
Date: Mon, 05 May 2003 11:04:13 +0200
This patch adds parsing to the DNSSEC (RFC 3225) DO/OK bit in packet-dns.c
In particular, it renames 'must be zero' field.
If anyone will ever use some of the rest 15 bits, it might be worth converting it to a bit array.
Attached is also a capture with this bit turned on.
Diff'ed against 0.9.12.

Y.

Attachment: ends_dnsssec.cap
Description: Binary data

--- packet-dns.c	Sat Feb  1 01:08:46 2003
+++ packet-dns-y.c	Mon May  5 10:43:52 2003
@@ -803,7 +803,8 @@
   const char *name, int namelen, const char *type_name, int class,
   guint ttl, gushort data_len)
 {
-  proto_tree *rr_tree;
+  proto_tree *rr_tree, *Z_tree;
+  proto_item *Z_item = NULL;
 
   rr_tree = proto_item_add_subtree(trr, rr_type);
   proto_tree_add_text(rr_tree, tvb, offset, namelen, "Name: %s", name);
@@ -819,7 +820,13 @@
   proto_tree_add_text(rr_tree, tvb, offset, 1, "EDNS0 version: %u",
       (ttl >> 16) & 0xff);
   offset++;
-  proto_tree_add_text(rr_tree, tvb, offset, 2, "Must be zero: 0x%x", ttl & 0xffff);
+  Z_item = proto_tree_add_text(rr_tree, tvb, offset, 2, "Z: 0x%x", ttl & 0xffff);
+  if (ttl & 0x8000) {
+     Z_tree = proto_item_add_subtree(Z_item, rr_type);
+     proto_tree_add_text(Z_tree, tvb, offset, 2, "Bit 0 (DO bit): 1 (Accepts DNSSEC security RRs)");
+     proto_tree_add_text(Z_tree, tvb, offset, 2, "Bits 1-15: 0x%x (reserved)", (ttl >> 17) & 0xff);
+   
+  }
   offset += 2;
   proto_tree_add_text(rr_tree, tvb, offset, 2, "Data length: %u", data_len);
   return rr_tree;