summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-token.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tcpdump/print-token.c')
-rw-r--r--contrib/tcpdump/print-token.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/contrib/tcpdump/print-token.c b/contrib/tcpdump/print-token.c
index af4780c..faffd4b 100644
--- a/contrib/tcpdump/print-token.c
+++ b/contrib/tcpdump/print-token.c
@@ -22,20 +22,19 @@
*
* Further tweaked to more closely resemble print-fddi.c
* Guy Harris <guy@alum.mit.edu>
- *
- * $FreeBSD$
*/
-#define NETDISSECT_REWORKED
+/* \summary: Token Ring printer */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
#include <string.h>
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
#include "addrtoname.h"
#include "ether.h"
@@ -115,14 +114,13 @@ token_hdr_print(netdissect_options *ndo,
srcname = etheraddr_string(ndo, fsrc);
dstname = etheraddr_string(ndo, fdst);
- if (ndo->ndo_vflag)
- ND_PRINT((ndo, "%02x %02x %s %s %d: ",
+ if (!ndo->ndo_qflag)
+ ND_PRINT((ndo, "%02x %02x ",
trp->token_ac,
- trp->token_fc,
- srcname, dstname,
- length));
- else
- ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length));
+ trp->token_fc));
+ ND_PRINT((ndo, "%s > %s, length %u: ",
+ srcname, dstname,
+ length));
}
static const char *broadcast_indicator[] = {
@@ -151,8 +149,9 @@ u_int
token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
const struct token_header *trp;
- u_short extracted_ethertype;
+ int llc_hdrlen;
struct ether_header ehdr;
+ struct lladdr_info src, dst;
u_int route_len = 0, hdr_len = TOKEN_HDRLEN;
int seg;
@@ -205,6 +204,11 @@ token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
token_hdr_print(ndo, trp, length, ESRC(&ehdr), EDST(&ehdr));
}
+ src.addr = ESRC(&ehdr);
+ src.addr_string = etheraddr_string;
+ dst.addr = EDST(&ehdr);
+ dst.addr_string = etheraddr_string;
+
/* Skip over token ring MAC header and routing information */
length -= hdr_len;
p += hdr_len;
@@ -213,20 +217,14 @@ token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
/* Frame Control field determines interpretation of packet */
if (FRAME_TYPE(trp) == TOKEN_FC_LLC) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
- &extracted_ethertype) == 0) {
- /* ether_type not known, print raw packet */
- if (!ndo->ndo_eflag)
- token_hdr_print(ndo, trp,
- length + TOKEN_HDRLEN + route_len,
- ESRC(&ehdr), EDST(&ehdr));
- if (extracted_ethertype) {
- ND_PRINT((ndo, "(LLC %s) ",
- etherproto_string(htons(extracted_ethertype))));
- }
+ llc_hdrlen = llc_print(ndo, p, length, caplen, &src, &dst);
+ if (llc_hdrlen < 0) {
+ /* packet type not known, print raw packet */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
}
+ hdr_len += llc_hdrlen;
} else {
/* Some kinds of TR packet we cannot handle intelligently */
/* XXX - dissect MAC packets if frame type is 0 */
OpenPOWER on IntegriCloud