Merge remote-tracking branch 'goog/tcpdump'

* goog/tcpdump: (3066 commits)
  Remove old version. Getting ready for new tcpdump 4.5
  Support -Q for setting the capture direction.
  Clean up the TLV processing loop.
  With -A and -AA, don't send CRs to the standard output.
  Use the new libpcap <pcap/nflog.h> for NFLOG definitions and declarations.
  Do our own isascii(), isprint(), isgraph(), and toascii().
  Fix a compiler warning.
  Don't use the __attribute__((packed)) on most platforms.
  The interval in an AODV HELLO extension is not aligned on a 4-byte boundary.
  As with memcpy, so with memcmp.
  More UNALIGNED_MEM{CPY,CMP} on IP addresses.
  Another case where UNALIGNED_MEMCPY() is probably necessary.
  No need for casting back and forth.
  Only do the unaligned_mem{cpy,cmp} hack if necessary.
  No need to declare unaligned_mem{cpy,cmp} in netdissect.h *and* interface.h.
  More possibly-unaligned memcpy()s and assignments - use unaligned_memcpy().
  Check for compiling for IPv6; don't check whether we can create an IPv6 socket.
  Use unaligned_memcmp() to compare with IPv{4,6} addresses in a packet.
  Use EXTRACT_nBITS even when just testing against zero.
  Fix some more unaligned accesses.
  ...

Change-Id: I9e98707d30c989b9e32dcd5af798bd0746ab4434
diff --git a/print-domain.c b/print-domain.c
index d4a35d8..80e8ce9 100644
--- a/print-domain.c
+++ b/print-domain.c
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89.2.8 2007/02/13 19:19:27 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.98 2007-12-09 01:40:32 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -144,7 +144,7 @@
 		return(i);
 }
 
-static const u_char *
+const u_char *
 ns_nprint(register const u_char *cp, register const u_char *bp)
 {
 	register u_int i, l;
@@ -242,7 +242,7 @@
 }
 
 /* http://www.iana.org/assignments/dns-parameters */
-struct tok ns_type2str[] = {
+const struct tok ns_type2str[] = {
 	{ T_A,		"A" },			/* RFC 1035 */
 	{ T_NS,		"NS" },			/* RFC 1035 */
 	{ T_MD,		"MD" },			/* RFC 1035 */
@@ -307,7 +307,7 @@
 	{ 0,		NULL }
 };
 
-struct tok ns_class2str[] = {
+const struct tok ns_class2str[] = {
 	{ C_IN,		"IN" },		/* Not used */
 	{ C_CHAOS,	"CHAOS" },
 	{ C_HS,		"HS" },
@@ -387,13 +387,22 @@
 			printf(" (Cache flush)");
 	}
 
-	/* ignore ttl */
-	cp += 2;
-	/* if T_OPT, save opt_flags */
-	if (typ == T_OPT)
+	if (typ == T_OPT) {
+		/* get opt flags */
+		cp += 2;
 		opt_flags = EXTRACT_16BITS(cp);
-	/* ignore rest of ttl */
-	cp += 2;
+		/* ignore rest of ttl field */
+		cp += 2;
+	} else if (vflag > 2) {
+		/* print ttl */
+		printf(" [");
+		relts_print(EXTRACT_32BITS(cp));
+		printf("]");
+		cp += 4;
+	} else {
+		/* ignore ttl */
+		cp += 4;
+	}
 
 	len = EXTRACT_16BITS(cp);
 	cp += 2;
@@ -408,7 +417,7 @@
 	case T_A:
 		if (!TTEST2(*cp, sizeof(struct in_addr)))
 			return(NULL);
-		printf(" %s", ipaddr_string(cp));
+		printf(" %s", intoa(htonl(EXTRACT_32BITS(cp))));
 		break;
 
 	case T_NS:
@@ -475,15 +484,24 @@
 
 #ifdef INET6
 	case T_AAAA:
+	    {
+		struct in6_addr addr;
+		char ntop_buf[INET6_ADDRSTRLEN];
+
 		if (!TTEST2(*cp, sizeof(struct in6_addr)))
 			return(NULL);
-		printf(" %s", ip6addr_string(cp));
+		memcpy(&addr, cp, sizeof(struct in6_addr));
+		printf(" %s",
+		    inet_ntop(AF_INET6, &addr, ntop_buf, sizeof(ntop_buf)));
+
 		break;
+	    }
 
 	case T_A6:
 	    {
 		struct in6_addr a;
 		int pbit, pbyte;
+		char ntop_buf[INET6_ADDRSTRLEN];
 
 		if (!TTEST2(*cp, 1))
 			return(NULL);
@@ -497,7 +515,8 @@
 				return(NULL);
 			memset(&a, 0, sizeof(a));
 			memcpy(&a.s6_addr[pbyte], cp + 1, sizeof(a) - pbyte);
-			printf(" %u %s", pbit, ip6addr_string(&a));
+			printf(" %u %s", pbit,
+			    inet_ntop(AF_INET6, &a, ntop_buf, sizeof(ntop_buf)));
 		}
 		if (pbit > 0) {
 			putchar(' ');