* Routines for BOOTP/DHCP packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-bootp.c,v 1.2 1998/09/16 03:22:01 gerald Exp $
+ * $Id: packet-bootp.c,v 1.3 1998/09/17 03:29:26 gram Exp $
*
* The information used comes from:
* RFC 2132: DHCP Options and BOOTP Vendor Extensions
case opaque:
add_item_to_tree(bp_tree, voff, consumed,
- "Option %d: %s = %s (%d bytes)",
- code, text, &pd[voff+2], vlen);
+ "Option %d: %s (%d bytes)",
+ code, text, vlen);
break;
case val_u_short:
* Routines for Token-Ring packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
- * $Id: packet-tr.c,v 1.2 1998/09/16 03:22:11 gerald Exp $
+ * $Id: packet-tr.c,v 1.3 1998/09/17 03:29:27 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
int offset = 14;
int source_routed = 0;
int rif_bytes = 0;
+ int true_rif_bytes = 0; /* because of silly_linux */
guint8 nonsr_hwaddr[8];
int frame_type = (pd[1] & 192) >> 6; /* I use this value a lot */
#ifdef linux
/* sometimes we have a RCF but no RIF... half source-routed? */
/* I'll check for 2 bytes of RIF and the 0x70 byte */
if (!source_routed) {
- if ((pd[14] & 31) == 2 && pd[15] == 0x70) {
+ if ((pd[14] & 31) == 2) {
source_routed = 1;
}
}
if (source_routed) {
rif_bytes = pd[14] & 31;
+ true_rif_bytes = rif_bytes;
}
/* this is a silly hack for Linux 2.0.x. Read the comment below,
in front of the other #ifdef linux */
ether_to_str((guint8 *) &pd[8]));
if (source_routed) {
- add_item_to_tree(fh_tree, 14, 1, "RIF length: %d bytes",
- pd[14] & 31); /* not rif_bytes because of silly_linux */
+ add_item_to_tree(fh_tree, 14, 1, "RIF length: %d bytes", true_rif_bytes);
add_item_to_tree(fh_tree, 15, 1,
"%s, up to %d bytes in frame (LF=%d)",
/* if we have more than 2 bytes of RIF, then we have
ring/bridge pairs */
- if ((pd[14] & 31) > 2) { /* not rif_bytes because of silly_linux */
+ if (true_rif_bytes > 2) {
add_ring_bridge_pairs(rif_bytes, pd, fh_tree);
}
}
tcpdump. W/o that, however, I'm guessing that DSAP == SSAP if the
frame type is LLC. It's very much a hack. -- Gilbert Ramirez */
#ifdef linux
- if ( (source_routed && ((pd[14] & 31) == 2) && silly_linux) ||
- (!source_routed) && silly_linux ) {
+ if (source_routed && (true_rif_bytes == 2) && silly_linux) {
+ add_item_to_tree(fh_tree, 14 + true_rif_bytes, 18 - true_rif_bytes,
+ "Empty RIF from Linux 2.0.x driver. The sniffing NIC "
+ "is also running a protocol stack.");
+ }
+ else if ((!source_routed) && silly_linux ) {
add_item_to_tree(fh_tree, 14, 18,
"Empty RIF from Linux 2.0.x driver. The sniffing NIC "
"is also running a protocol stack.");
/lmargin 72 def
/tmargin vmax 72 sub def
/bmargin 72 def
+/pagenumtab hmax 72 sub def
% Counters
-/vpos vmax 70 sub def
+/vpos vmax 40 sub def
+/thispagenum 1 def
+% Strings
+/pagenostr 7 string def
+
+% Prints text with possible indenting
/putline {
exch 10 mul lmargin add % X
vpos % Y
/vpos vpos 10 sub def
vpos bmargin le % is vpos <= bottom margin?
- {showpage
- /vpos tmargin def}
+ {
+ printpagenum showpage
+ /vpos tmargin def
+ }
if % then formfeed and start at top
} def
+% A putline with no indenting
/hexdump {
lmargin % X
vpos % Y
/vpos vpos 10 sub def
vpos bmargin le % is vpos <= bottom margin?
- {showpage
- /vpos tmargin def}
+ {
+ printpagenum showpage
+ /vpos tmargin def
+ }
if % then formfeed and start at top
} def
+% A put line with smaller spacing and no formfeed
+/titleline {
+ lmargin % X
+ vpos % Y
+ moveto
+ show
+
+ /vpos vpos 8 sub def
+} def
+
+% Prints the page number at the top right
+/printpagenum {
+ gsave
+ % Set the font to 8 point
+ /Helvetica findfont 8 scalefont setfont
+
+ pagenumtab % X
+ vmax 40 sub % Y
+ moveto
+ (Page ) show
+ thispagenum pagenostr cvs show
+
+ % thispagenum++
+ /thispagenum thispagenum 1 add def
+ grestore
+} def
+
+% Set the font to 8 point
+/Helvetica findfont 8 scalefont setfont
+
+% Create the title
+(Ethereal) titleline
+
+% Reset the vertical position
+/vpos tmargin def
+
% Set the font to 10 point
/Helvetica findfont 10 scalefont setfont
+% ---- ethereal preamble end ---- %
% Display our output lines.
-% ---- ethereal preamble end ---- %
0 (Ethernet II \(98 on wire, 68 captured\)) putline
1 (Destination: 00:00:0c:36:00:2a) putline
1 (Source: 00:c0:4f:c7:eb:c0) putline
( b0 0000 0000 0000 ...... ) hexdump
% ---- ethereal finale start ---- %
+% If this is not the first page, then print the page number
+thispagenum 1 gt % is thispagenum > 1 ?
+{
+ printpagenum
+}
+if
+
showpage
% ---- ethereal finale end ---- %