Ethereal-dev: [Ethereal-dev] patch: packet-dns.c - show Z flag in DNS flags

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: Tue, 06 May 2003 13:23:44 +0200
It's reserved, and should be 0 at all times, but I'd like to see that it is indeed 0.
Attached patch against 0.9.12.

--- packet-dns.c	Sat Feb  1 01:08:46 2003
+++ packet-dns.y.c	Tue May  6 13:09:28 2003
@@ -51,6 +51,7 @@
 static int hf_dns_flags_truncated = -1;
 static int hf_dns_flags_recdesired = -1;
 static int hf_dns_flags_recavail = -1;
+static int hf_dns_flags_z = -1;
 static int hf_dns_flags_authenticated = -1;
 static int hf_dns_flags_checkdisable = -1;
 static int hf_dns_flags_rcode = -1;
@@ -157,6 +158,7 @@
 #define F_TRUNCATED     (1<<9)          /* response is truncated */
 #define F_RECDESIRED    (1<<8)          /* recursion desired */
 #define F_RECAVAIL      (1<<7)          /* recursion available */
+#define F_Z		(1<<6)		/* Z */
 #define F_AUTHENTIC     (1<<5)          /* authentic data (RFC2535) */
 #define F_CHECKDISABLE  (1<<4)          /* checking disabled (RFC2535) */
 #define F_RCODE         (0xF<<0)        /* reply code */
@@ -186,6 +188,11 @@
 	"Server can't do recursive queries"
 };
 
+static const true_false_string tfs_flags_z = {
+	"reserved - incorrect!",
+	"reserved (0)"
+};
+
 static const true_false_string tfs_flags_authenticated = {
 	"Answer/authority portion was authenticated by the server",
 	"Answer/authority portion was not authenticated by the server"
@@ -1995,11 +2002,15 @@
     if (flags & F_RESPONSE) {
       proto_tree_add_item(field_tree, hf_dns_flags_recavail,
 			  tvb, offset + DNS_FLAGS, 2, FALSE);
+      proto_tree_add_item(field_tree, hf_dns_flags_z,
+			 tvb, offset + DNS_FLAGS, 2, FALSE);
       proto_tree_add_item(field_tree, hf_dns_flags_authenticated,
 			  tvb, offset + DNS_FLAGS, 2, FALSE);
       proto_tree_add_item(field_tree, hf_dns_flags_rcode,
 			  tvb, offset + DNS_FLAGS, 2, FALSE);
     } else {
+      proto_tree_add_item(field_tree, hf_dns_flags_z,
+                           tvb, offset + DNS_FLAGS, 2, FALSE);
       proto_tree_add_item(field_tree, hf_dns_flags_checkdisable,
 			  tvb, offset + DNS_FLAGS, 2, FALSE);
     }
@@ -2149,6 +2160,10 @@
       { "Recursion available",	"dns.flags.recavail",
 	FT_BOOLEAN, 16, TFS(&tfs_flags_recavail), F_RECAVAIL,
 	"Can the server do recursive queries?", HFILL }},
+    { &hf_dns_flags_z,
+      { "Z", "dns.flags.z",
+	FT_BOOLEAN, 16, TFS(&tfs_flags_z), F_Z,
+	"Z flag", HFILL }},
     { &hf_dns_flags_authenticated,
       { "Answer authenticated",	"dns.flags.authenticated",
 	FT_BOOLEAN, 16, TFS(&tfs_flags_authenticated), F_AUTHENTIC,