summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-sll.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-07-11 03:54:22 +0000
committersam <sam@FreeBSD.org>2005-07-11 03:54:22 +0000
commit1166f90fe87cef69f7923a1b8c386eecdc6cb92b (patch)
tree87e350d89f0c352cd41839a49086d78bf700350e /contrib/tcpdump/print-sll.c
parenta6836add6eafd2d06f4eeb7200e8217ba3399c1b (diff)
downloadFreeBSD-src-1166f90fe87cef69f7923a1b8c386eecdc6cb92b.zip
FreeBSD-src-1166f90fe87cef69f7923a1b8c386eecdc6cb92b.tar.gz
Virgin import of tcpdump v3.9.1 (release) from tcpdump.org
Approved by: re (scottl)
Diffstat (limited to 'contrib/tcpdump/print-sll.c')
-rw-r--r--contrib/tcpdump/print-sll.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/contrib/tcpdump/print-sll.c b/contrib/tcpdump/print-sll.c
index aeb0610..6ac51e1 100644
--- a/contrib/tcpdump/print-sll.c
+++ b/contrib/tcpdump/print-sll.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.16 2004/10/28 00:34:29 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.16.2.1 2005/04/26 00:16:43 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -53,6 +53,8 @@ const struct tok sll_pkttype_values[] = {
static inline void
sll_print(register const struct sll_header *sllp, u_int length)
{
+ u_short ether_type;
+
printf("%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_16BITS(&sllp->sll_pkttype)));
/*
@@ -63,11 +65,44 @@ sll_print(register const struct sll_header *sllp, u_int length)
if (EXTRACT_16BITS(&sllp->sll_halen) == 6)
(void)printf("%s ", etheraddr_string(sllp->sll_addr));
- if (!qflag)
- (void)printf("ethertype %s (0x%04x), length %u: ",
- tok2str(ethertype_values,"Unknown", EXTRACT_16BITS(&sllp->sll_protocol)),
- EXTRACT_16BITS(&sllp->sll_protocol),
- length);
+ if (!qflag) {
+ ether_type = EXTRACT_16BITS(&sllp->sll_protocol);
+
+ if (ether_type <= ETHERMTU) {
+ /*
+ * Not an Ethernet type; what type is it?
+ */
+ switch (ether_type) {
+
+ case LINUX_SLL_P_802_3:
+ /*
+ * Ethernet_802.3 IPX frame.
+ */
+ (void)printf("802.3");
+ break;
+
+ case LINUX_SLL_P_802_2:
+ /*
+ * 802.2.
+ */
+ (void)printf("802.3");
+ break;
+
+ default:
+ /*
+ * What is it?
+ */
+ (void)printf("ethertype Unknown (0x%04x)",
+ ether_type);
+ break;
+ }
+ } else {
+ (void)printf("ethertype %s (0x%04x)",
+ tok2str(ethertype_values, "Unknown", ether_type),
+ ether_type);
+ }
+ (void)printf(", length %u: ", length);
+ }
}
/*
OpenPOWER on IntegriCloud