A6 and DNAME resource record support, and RFC 2673 bitstring label
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 2 Oct 2000 17:42:38 +0000 (17:42 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 2 Oct 2000 17:42:38 +0000 (17:42 +0000)
support, from Per Flock.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2473 f5534014-38df-0310-8fa8-9805f1628bb7

AUTHORS
doc/ethereal.pod.template
packet-dns.c

diff --git a/AUTHORS b/AUTHORS
index 6906ba6f9569706abab91f2f76edcf0f99039552..a0593af321fdc9ee665e8cd625b817a1cd0d1184 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -386,6 +386,11 @@ Craig Metz <cmetz@inner.net> {
        OSPF type 7 LSA dissection
 }
 
+Per Flock <per.flock@axis.com> {
+       A6 and DNAME resource record support
+       RFC 2673 bitstring label support
+}
+
 Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to
 give his permission to use his version of snprintf.c.
 
index 8ab34a22f8b9e37fe8f081ce41dd3e2704f3921d..b09884a757a8b3132a1db78d5b7892e2410f482e 100644 (file)
@@ -985,6 +985,7 @@ B<http://ethereal.zing.org>.
   Wes Hardaker             <wjhardaker@ucdavis.edu>
   Robert Tsai              <rtsai@netapp.com>
   Craig Metz               <cmetz@inner.net>
+  Per Flock                <per.flock@axis.com>
 
 Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to give his
 permission to use his version of snprintf.c.
index 1b77492b2478d57af47fb3bf39dbe3a3b4286f45..b30aa5f50da8e543b4897913ab6a644778b4a77f 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-dns.c
  * Routines for DNS packet disassembly
  *
- * $Id: packet-dns.c,v 1.53 2000/08/18 09:05:02 itojun Exp $
+ * $Id: packet-dns.c,v 1.54 2000/10/02 17:42:29 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -112,6 +112,7 @@ static gint ett_t_key_flags = -1;
 #define T_ATMA          34              /* ??? */
 #define T_NAPTR         35              /* naming authority pointer (RFC 2168) */
 #define T_A6           38              /* IPv6 address with indirection (RFC 2874) */
+#define T_DNAME         39              /* Non-terminal DNS name redirection (RFC 2672) */
 #define T_OPT          41              /* OPT pseudo-RR (RFC 2671) */
 #define T_WINS         65281           /* Microsoft's WINS RR */
 #define T_WINS_R       65282           /* Microsoft's WINS-R RR */
@@ -200,7 +201,7 @@ dns_type_name (u_int type)
     NULL,
     NULL,
     "A6",                              /* RFC 2874 */
-    NULL,
+    "DNAME",                           /* RFC 2672 */
     NULL,
     "OPT"                              /* RFC 2671 */
   };
@@ -286,7 +287,7 @@ dns_long_type_name (u_int type)
     NULL,
     NULL,
     "IPv6 address with indirection",   /* RFC 2874 */
-    NULL,
+    "Non-terminal DNS name redirection", /* RFC 2672 */
     NULL,
     "EDNS0 option"                     /* RFC 2671 */
   };
@@ -402,6 +403,34 @@ get_dns_name(const u_char *pd, int offset, int dns_data_offset,
       break;
 
     case 0x40:
+      /* Extended label (RFC 2673) */
+      switch (component_len & 0x3f) {
+
+      case 0x01:
+       /* Bitstring label */
+       {
+         int bit_count;
+         int label_len;
+
+         bit_count = *dp++;
+         label_len = (bit_count - 1) / 8 + 1;
+       
+         np += sprintf(np, "\\[x");
+         while(label_len--) {
+           np += sprintf(np, "%02x", *dp++);
+         }
+         np += sprintf(np, "/%d]", bit_count);
+       }
+       break;
+
+      default:
+       strcpy(name, "<Unknown extended label>");
+       /* Parsing will propably fail from here on, since the */
+       /* label length is unknown... */
+       return dp - dptr;
+      }
+      break;
+
     case 0x80:
       goto error;      /* error */
 
@@ -1346,6 +1375,98 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset,
     }
     break;
 
+  case T_A6:
+    {
+      unsigned short pre_len;
+      unsigned short suf_len;
+      unsigned short suf_octet_count;
+      char pname[MAXDNAME];
+      int pname_len;
+      int a6_offset;
+      int suf_offset;
+      guint8 suffix[16];
+
+      a6_offset = cur_offset;
+      if (!BYTES_ARE_IN_FRAME(cur_offset, 1)) {
+        /* We ran past the end of the captured data in the packet. */
+        return 0;
+      }
+      pre_len = pd[cur_offset++];
+      suf_len = 128 - pre_len;
+      suf_octet_count = (suf_len - 1) / 8 + 1;
+      if (!BYTES_ARE_IN_FRAME(cur_offset, suf_octet_count)) {
+        /* We ran past the end of the captured data in the packet. */
+        return 0;
+      }
+      /* Pad prefix */
+      for (suf_offset = 0; suf_offset < 16 - suf_octet_count; suf_offset++) {
+        suffix[suf_offset] = 0;
+      }
+      for (; suf_offset < 16; suf_offset++) {
+        suffix[suf_offset] = pd[cur_offset++];
+      }
+
+      pname_len = get_dns_name(pd, cur_offset, dns_data_offset, 
+                               pname, sizeof(pname));
+      if (pname_len < 0) {
+        /* We ran past the end of the captured data in the packet. */
+        return 0;
+      }
+
+      if (fd != NULL) {
+        col_append_fstr(fd, COL_INFO, " %d %s %s", 
+                        pre_len, 
+                        ip6_to_str((struct e_in6_addr *)&suffix), 
+                        pname);
+      }
+      if (dns_tree != NULL) {
+        proto_tree_add_text(rr_tree, NullTVB, a6_offset, 1, 
+                            "Prefix len: %u", pre_len);
+        a6_offset++;
+        proto_tree_add_text(rr_tree, NullTVB, a6_offset, suf_octet_count,
+                            "Address suffix: %s", 
+                            ip6_to_str((struct e_in6_addr *)&suffix));
+        a6_offset += suf_octet_count;
+        proto_tree_add_text(rr_tree, NullTVB, a6_offset, pname_len, 
+                            "Prefix name: %s", pname);
+        proto_item_set_text(trr, "%s: type %s, class %s, addr %d %s %s",
+                            name, 
+                            type_name, 
+                            class_name, 
+                            pre_len, 
+                            ip6_to_str((struct e_in6_addr *)&suffix), 
+                            pname);
+      }
+    }
+    break;
+
+  case T_DNAME:
+    {
+      char dname[MAXDNAME];
+      int dname_len;
+      
+      dname_len = get_dns_name(pd, cur_offset, dns_data_offset, 
+                              dname, sizeof(dname));
+      if (dname_len < 0) {
+       /* We ran past the end of the captured data in the packet. */
+       if (dns_tree != NULL) {
+         proto_item_set_text(trr,
+                             "%s: type %s, class %s, <Primary name goes past end of captured data in packet>",
+                             name, type_name, class_name);
+       }
+       return 0;
+      }
+      if (fd != NULL)
+       col_append_fstr(fd, COL_INFO, " %s", dname);
+      if (dns_tree != NULL) {
+       proto_item_set_text(trr, "%s: type %s, class %s, dname %s",
+                           name, type_name, class_name, dname);
+       proto_tree_add_text(rr_tree, NullTVB, cur_offset, 
+                           dname_len, "Target name: %s", dname);
+      }
+    }
+    break;
+
   case T_LOC:
     {
       if (dns_tree != NULL) {