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-lane.c b/print-lane.c
index 1c3c2c2..aa79311 100644
--- a/print-lane.c
+++ b/print-lane.c
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.23.2.2 2005/11/13 12:12:59 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.25 2005-11-13 12:12:42 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -60,25 +60,10 @@
 	{ 0,		NULL }
 };
 
-static inline void
-lane_hdr_print(register const u_char *bp, int length)
+static void
+lane_hdr_print(netdissect_options *ndo, const u_char *bp)
 {
-	register const struct lecdatahdr_8023 *ep;
-
-	ep = (const struct lecdatahdr_8023 *)bp;
-	if (qflag)
-		(void)printf("lecid:%x %s %s %d: ",
-			     EXTRACT_16BITS(&ep->le_header),
-			     etheraddr_string(ep->h_source),
-			     etheraddr_string(ep->h_dest),
-			     length);
-	else
-		(void)printf("lecid:%x %s %s %s %d: ",
-			     EXTRACT_16BITS(&ep->le_header),
-			     etheraddr_string(ep->h_source),
-			     etheraddr_string(ep->h_dest),
-			     etherproto_string(ep->h_type),
-			     length);
+	(void)ND_PRINT((ndo, "lecid:%x ", EXTRACT_16BITS(bp)));
 }
 
 /*
@@ -93,9 +78,6 @@
 lane_print(const u_char *p, u_int length, u_int caplen)
 {
 	struct lane_controlhdr *lec;
-	struct lecdatahdr_8023 *ep;
-	u_short ether_type;
-	u_short extracted_ethertype;
 
 	if (caplen < sizeof(struct lane_controlhdr)) {
 		printf("[|lane]");
@@ -113,49 +95,18 @@
 		return;
 	}
 
-	if (caplen < sizeof(struct lecdatahdr_8023)) {
-		printf("[|lane]");
-		return;
-	}
-
-	if (eflag)
-		lane_hdr_print(p, length);
+	/*
+	 * Go past the LE header.
+	 */
+	length -= 2;
+	caplen -= 2;
+	p += 2;
 
 	/*
-	 * Go past the LANE header.
+	 * Now print the encapsulated frame, under the assumption
+	 * that it's an Ethernet frame.
 	 */
-	length -= sizeof(struct lecdatahdr_8023);
-	caplen -= sizeof(struct lecdatahdr_8023);
-	ep = (struct lecdatahdr_8023 *)p;
-	p += sizeof(struct lecdatahdr_8023);
-
-	ether_type = EXTRACT_16BITS(&ep->h_type);
-
-	/*
-	 * Is it (gag) an 802.3 encapsulation?
-	 */
-	if (ether_type <= ETHERMTU) {
-		/* Try to print the LLC-layer header & higher layers */
-		if (llc_print(p, length, caplen, ep->h_source, ep->h_dest,
-		    &extracted_ethertype) == 0) {
-			/* ether_type not known, print raw packet */
-			if (!eflag)
-				lane_hdr_print((u_char *)ep, length + sizeof(*ep));
-			if (extracted_ethertype) {
-				printf("(LLC %s) ",
-			       etherproto_string(htons(extracted_ethertype)));
-			}
-			if (!suppress_default_print)
-				default_print(p, caplen);
-		}
-	} else if (ether_encap_print(ether_type, p, length, caplen,
-	    &extracted_ethertype) == 0) {
-		/* ether_type not known, print raw packet */
-		if (!eflag)
-			lane_hdr_print((u_char *)ep, length + sizeof(*ep));
-		if (!suppress_default_print)
-			default_print(p, caplen);
-	}
+	ether_print(gndo, p, length, caplen, lane_hdr_print, p - 2);
 }
 
 u_int