summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-lane.c
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2010-10-28 19:06:17 +0000
committerrpaulo <rpaulo@FreeBSD.org>2010-10-28 19:06:17 +0000
commit1e8ad3bd802d66bed71b4c6405ff5d801a913e4a (patch)
treedf5e0d876c3ec2ff0e3d9c6795cb5c1e20b7d5c4 /contrib/tcpdump/print-lane.c
parent7ab661360c2131496bd3c111b5b3b2462fe3d2be (diff)
parent5f4de8e61a87fc21b6ffecf7ef9444827c09ee69 (diff)
downloadFreeBSD-src-1e8ad3bd802d66bed71b4c6405ff5d801a913e4a.zip
FreeBSD-src-1e8ad3bd802d66bed71b4c6405ff5d801a913e4a.tar.gz
Merge tcpdump-4.1.1.
Diffstat (limited to 'contrib/tcpdump/print-lane.c')
-rw-r--r--contrib/tcpdump/print-lane.c69
1 files changed, 10 insertions, 59 deletions
diff --git a/contrib/tcpdump/print-lane.c b/contrib/tcpdump/print-lane.c
index 33723aa..54c68c8 100644
--- a/contrib/tcpdump/print-lane.c
+++ b/contrib/tcpdump/print-lane.c
@@ -60,25 +60,10 @@ static const struct tok lecop2str[] = {
{ 0, NULL }
};
-static inline void
-lane_hdr_print(register const u_char *bp, int length)
+static void
+lane_hdr_print(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)printf("lecid:%x ", EXTRACT_16BITS(bp));
}
/*
@@ -93,9 +78,6 @@ void
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 @@ lane_print(const u_char *p, u_int length, u_int caplen)
return;
}
- if (caplen < sizeof(struct lecdatahdr_8023)) {
- printf("[|lane]");
- return;
- }
-
- if (eflag)
- lane_hdr_print(p, length);
-
/*
- * Go past the LANE header.
+ * Go past the LE header.
*/
- 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);
+ length -= 2;
+ caplen -= 2;
+ p += 2;
/*
- * Is it (gag) an 802.3 encapsulation?
+ * Now print the encapsulated frame, under the assumption
+ * that it's an Ethernet frame.
*/
- 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(p, length, caplen, lane_hdr_print, p - 2);
}
u_int
OpenPOWER on IntegriCloud