tcpdump mailing list archives

Re: -e vs. -x, revisited


From: Andrew Brown <atatat () atatdot net>
Date: Tue, 17 Dec 2002 08:21:39 -0500

Unless somebody comes up with a good reason *NOT* to make "-e" cause
"-x" and "-X" to dump the link-layer header, it sounds like something we
should do, although, unfortunately, it means changing most if not all
"XXX_if_print()" routines (as the call to "default_print()" generally
passes a pointer and a length that have already been stepped past the
link-layer header, so we'd have to save the original pointer and capture
length in separate variables and step them forward if "eflag" isn't
true, and pass *those* to "default_print()", or put the link-layer
header back before calling "default_print()" if "eflag" is specified).

actually, it oughta be simpler than you think.  provided that all the
functions that may end up being returned from lookup_printer() set
packetp and snapend (as it seems they do), then one could simply
change default_print_unaligned as follows:

@@ -750,6 +765,10 @@ default_print_unaligned(register const u
        register u_int i, s;
        register int nshorts;
 
+       if (eflag) {
+               cp = packetp;
+               length = snapend - packetp;
+       }
        if (Xflag) {
                ascii_print(cp, length);
                return;

no?

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior () daemon org             * "ah!  i see you have the internet
twofsonet () graffiti com (Andrew Brown)                that goes *ping*!"
werdna () squooshy com       * "information is power -- share the wealth."
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: