Commit graph

866 commits

Author SHA1 Message Date
Guy Harris
46def2b1d9 Phil Techau's patch to allocate colors read-only and, if we can't get
that color from the system colormap, get the best color mode from GTK+,
allocate a new colormap, and use that colormap.

svn path=/trunk/; revision=784
1999-10-07 22:50:45 +00:00
Guy Harris
361fcf26e9 Make "dfilter_error()" available to the lexical analyzer.
Get rid of the declaration of the non-existent "dfilter_yyerror()", and
put in some #defines to work around the fact that the #defines to
replace "yy" with "dfilter_" in the names of Flex-generated and
Yacc-generated routines aren't put into a header file, they're put into
".c" files.

Have it remember the error message it was handed (unless it's Yacc's
boring "parse error" message).

When generating the message to be shown to the user on a parse error,
make it be the "Unable to parse filter string" message, and, if a
non-boring error message was supplied to "dfilter_error()", take that
error message onto the end.

Don't panic if a field type we don't yet support in the parser is seen;
generate an error, telling the user we don't support filter on that type
yet.

Don't assume that "global_df" has been set if we see an empty statement
(if the first token was the end-marker, because, say, the first token
the lexical analyzer found was a field of a type not yet supported in
filter expressions, "global_df" won't have been set).

svn path=/trunk/; revision=783
1999-10-07 21:47:20 +00:00
Laurent Deniel
728ec33cb9 - add display filters
- check for truncated header

svn path=/trunk/; revision=782
1999-10-07 17:11:11 +00:00
Guy Harris
c6e161e7df A DNS or NBNS name may contain pointers to other names in the packet; if
the stuff referred to by those pointers goes past the end of the packet,
that's not a reason not to return the length of the DNS or NBNS name
itself - you can tag that name even though it's bad.  Therefore,
"get_dns_name()" should return the length of the part of the name it's
looked at even if that name contains a pointer to stuff that goes past
the end of the packet.

This means you can't check its return value to see if it's negative, and
treat it as an error if it is; remove that stuff.

Add checks to make sure the type and class fields in an RR don't go past
the end of the packet.

svn path=/trunk/; revision=781
1999-10-07 09:21:38 +00:00
Guy Harris
db5f4239dc Add NBNS support.
svn path=/trunk/; revision=780
1999-10-07 07:55:12 +00:00
Guy Harris
1fa5650f17 Add more packet bounds checking to DNS, and add some to NetBIOS-over-TCP
as well.

svn path=/trunk/; revision=779
1999-10-07 07:44:29 +00:00
Gilbert Ramirez
5afbccc62c Fixed the infinite-loop problem in the DNS dissector, at least for
the random packets I generated. I'm not convinced that all the problems
are gone. We now:

1. Check that the bytes are indded in the frame before accessing them
	in dissect_dns_query() and dissect_dns_answer(). If not, we
	return 0, which means "0-byte increment".

2. Check the return value of the two functions above in
	dissect_query_records() and dissect_answer_records(), which have
	loops that call those two functions above. If a 0-byte
	increment is found, the loop is broken to avoid an infinite loop.

svn path=/trunk/; revision=778
1999-10-07 02:26:45 +00:00
Gilbert Ramirez
48161094d3 Added ICMP and DNS to randpkt.
svn path=/trunk/; revision=777
1999-10-06 20:29:26 +00:00
Gilbert Ramirez
1b7bd2f14b Fix dfilter scanner to accept hyphenated hostnames for IPv4 addresses.
svn path=/trunk/; revision=776
1999-10-06 18:42:40 +00:00
Guy Harris
38f351e7d7 Give it a copyright notice and RCS ID.
svn path=/trunk/; revision=775
1999-10-06 03:38:37 +00:00
Guy Harris
2ea1e6edf5 Give them RCS IDs.
svn path=/trunk/; revision=774
1999-10-06 03:33:48 +00:00
Guy Harris
d86ecc2302 Whitespace cleanup.
svn path=/trunk/; revision=773
1999-10-06 03:30:21 +00:00
Guy Harris
0d43b16fdd Add "wtap_file_encap()", to return the encapsulation of packets in the
file (which could be WTAP_ENCAP_UNKNOWN, if we couldn't determine it, or
WTAP_ENCAP_PER_PACKET, if we could determine the encapsulation of
packets in the file, but they didn't all have the same encapsulation).
This may be useful in the future, if we allow files to be saved in
different capture file formats - we'd have to specify, when creating the
capture file, the per-file encapsulation, for those formats that don't
support per-packet encapsulations (we wouldn't be able to save a
multi-encapsulation capture in those formats).

Make the code to read "iptrace" files set the per-file packet
encapsulation - set it to the type of the first packet seen, and, if any
subsequent packets have a different encapsulation, set it to
WTAP_ENCAP_PER_PACKET.

svn path=/trunk/; revision=772
1999-10-06 03:29:36 +00:00
Guy Harris
0161298edd Make "create_color_sel_win()" static to "colors.c" - it's not used
outside that file.

svn path=/trunk/; revision=771
1999-10-05 18:10:34 +00:00
Guy Harris
66c411777b Make "wtap_strerror()" handle zlib errors *correctly*.
svn path=/trunk/; revision=770
1999-10-05 07:22:53 +00:00
Guy Harris
5f7868c7e0 Better handle errors from zlib:
Assign a range of Wiretap errors for zlib errors, and have
	"wtap_strerror()" use "zError()" to get an error message for
	them.

	Have the internal "file_error()" routine return 0 for no error
	and a Wiretap error code for an error.

svn path=/trunk/; revision=769
1999-10-05 07:06:08 +00:00
Gilbert Ramirez
03b75d6279 Added Santeri Paavolainen's <santtu@ssh.fi> patch to set default colors
in the color selection wheel.

Added his patch to file.c to look for bogus frame_data pointers, but made
it a g_assert().

Modified my previous patch to colors.c to skip bad color display filters.
I skipped them, but they still appeared in the color dialogue. Now bad
filtes are not put into the color filter list, so they don't appear in
the color dialogue. As a [good] side-effect, the next time you save
your color filter list, the bad filters are removed from the colorfilters
file.

svn path=/trunk/; revision=768
1999-10-05 04:34:00 +00:00
Gilbert Ramirez
fa62d9d109 Corrected comment regarding usage.
svn path=/trunk/; revision=767
1999-10-04 18:53:26 +00:00
Gilbert Ramirez
b73cea0fca Removed dummy protocol and removed bug which prevented the first
registered protocol's name from being used in a display filter.

svn path=/trunk/; revision=766
1999-10-04 18:09:05 +00:00
Gilbert Ramirez
29cbbd3fc1 Let color filter routines survive a bad display filter. It used to
segfault on a bad colorfilters file. This file now works as expected;
that is, the second filter is ignored:

# DO NOT EDIT THIS FILE!  It was created by Ethereal
@ipx@ipx@[65535,65535,65535][65535,19104,22902]
@bad@bad@[65535,65535,65535][65535,19104,22902]

svn path=/trunk/; revision=765
1999-10-04 15:00:20 +00:00
Laurent Deniel
1f09e79b60 - add ARP display filters
- check for truncated header

svn path=/trunk/; revision=764
1999-10-03 17:12:15 +00:00
Laurent Deniel
5084625f9b Oops, forgot to check truncated header.
Please, please in new dissector routines, check for
truncated packets, especially when string operations
or loop on bytes are used (to avoid display of erroneous
data and infinite loop or segmentation violation) !

svn path=/trunk/; revision=763
1999-10-03 15:21:11 +00:00
Laurent Deniel
c30bd27601 packet-aarp.c:
- add display filter for AARP

proto.c:
- register a dummy protocol before the first one (aarp)
  since the first entry can not be filtered (bug ?)
  Gilbert, could you check this ?

svn path=/trunk/; revision=762
1999-10-03 15:06:28 +00:00
Laurent Deniel
b6b303475e Fix request argument display with some pop clients
that send only '\n' instead of '\r''\n' and handle
more correctly truncated packets.

svn path=/trunk/; revision=761
1999-10-03 13:44:32 +00:00
Guy Harris
06494664b0 "gmtime()" takes a pointer to a "time_t", not a pointer to a "guint32",
as an argument.  ("time_t" could be 64 bits - I think it is 64 bits on
some platforms, e.g.  Alpha Linux - and it's typically signed rather
than unsigned.)

svn path=/trunk/; revision=760
1999-10-03 05:01:56 +00:00
Richard Sharpe
d9535765e8 A small fix to the handling of NetBIOS continuation messages where a
POSITIVE_SESSION_ACK was treated as a continuation :-(

svn path=/trunk/; revision=759
1999-10-03 01:19:25 +00:00
Richard Sharpe
776a369f1a A bunch of fixes for SMB decode.
1. Fix some silly errors.
  2. Dont decode beyond Word Count if errcode > 0
  3. Decode a bunch mode SMBs

Next is to keep state so we can do a better job ...

svn path=/trunk/; revision=758
1999-10-03 01:14:33 +00:00
Guy Harris
dcb17b4bb6 Don't initialize the file name field in the "File/Open" dialog box with
the name of the current save file - we no longer have the "-F" flag, and
"-S" automatically reads from the capture file as packets arrive, so
there's no need to manually open the capture file.

svn path=/trunk/; revision=757
1999-10-02 20:25:45 +00:00
Guy Harris
12e0703c0d Get rid of some unused fields in a "capture_file" structure.
svn path=/trunk/; revision=756
1999-10-02 20:23:53 +00:00
Guy Harris
79ec5a3ba9 Get rid of "-F" - "-S" works, and has a more convenient UI.
Print a usage message if an illegal command-line flag is seen.

Clean up the usage message a bit.

svn path=/trunk/; revision=755
1999-10-02 20:00:46 +00:00
Guy Harris
37aa821603 Wrap stufff that's used only if we have "libpcap" in "#ifdef
HAVE_LIBPCAP"/"#endif".

svn path=/trunk/; revision=754
1999-10-02 19:33:14 +00:00
Guy Harris
3395559532 Move the declaration of global variables involved with packet capture
from "globals.h" to "capture.h".

Only "capture.c" needs to include <pcap.h>; move the include of <pcap.h>
from "capture.h" to "capture.c".

We no longer need any DLT_ defines (that's handled inside Wiretap);
remove the defines of DLT_ from "capture.h".

svn path=/trunk/; revision=753
1999-10-02 19:24:27 +00:00
Laurent Deniel
3d59704877 Check for truncated header.
svn path=/trunk/; revision=752
1999-10-02 16:58:41 +00:00
Laurent Deniel
6269de2c37 Add ICMP display filters.
svn path=/trunk/; revision=751
1999-10-02 16:21:07 +00:00
Laurent Deniel
58aba1ccb3 Fix IGMP dfilter (some fields were registered and so
documented in man but the new dfilter functions were
not used).

svn path=/trunk/; revision=750
1999-10-02 15:55:28 +00:00
Guy Harris
efe95352f9 Add a file name field to the "Capture/Start" dialog box; if it's blank,
the capture will be done to a temporary file, otherwise it'll be done to
the specified file.

svn path=/trunk/; revision=749
1999-10-02 07:13:20 +00:00
Guy Harris
3d2cc0cb06 Have "do_capture()" take, as an argument, a pointer to the name of the
file to which to write the capture; if it's NULL, create a temporary
file and use that.

Have "-w" set a local variable, which starts out null, and, for "-k"
captures, call "do_capture()" and pass it that local variable as an
argument; this lets you do "-k" without "-w", which makes it use a
temporary file for the capture.

This means "run_capture()" no longer serves a useful purpose, as its
only caller is "do_capture()"; swallow it into "do_capture()".

svn path=/trunk/; revision=748
1999-10-02 06:26:53 +00:00
Guy Harris
b34d0437c9 A child process for a "-S" or "-F" capture should *always* exit when the
capture is done; make it do so, and don't bother passing it a "-Q" flag
to tell it to do so.

"capture()" is called in two places; in one place, it's in a child
process, and it shouldn't read in the capture file.  Move the reading of
the capture file out of "capture()" itself to the place where we
*should* read in the capture file after it returns.  Also, have it
return an indication of whether it succeeded or failed, so we know
whether we should read in the capture file.

svn path=/trunk/; revision=747
1999-10-02 06:00:07 +00:00
Guy Harris
60f385ac01 Move the definitions of "sync_mode", "sync_pipe", "fork_mode",
"quit_after_cap", and "capture_child" from "gtk/main.c" to "capture.c",
so that the definitions don't have to be duplicated in "main.c" for
other UIs if, as, and when we do versions of Ethereal with other UIs.

svn path=/trunk/; revision=746
1999-10-01 21:52:03 +00:00
Guy Harris
056ae6eb5e Uwe Girlich's patch to handle OSes (e.g., SINIX) that lack
"strncasecmp()" or "mkstemp()"; add in source to the GNU "libc"
versions, and have the "configure" script check for the routines in
question and set up the Makefile to build from our versions if they're
missing.

svn path=/trunk/; revision=745
1999-10-01 21:41:38 +00:00
Guy Harris
57772323ad A "time units" value of 5 means "microseconds", according to an FDDI
Sniffer trace, and printout therefrom, sent to me by Jeff Foster.  (The
Sniffer manuals I'd had a chance to read didn't say what the units
were.)

svn path=/trunk/; revision=744
1999-09-30 20:34:26 +00:00
Gilbert Ramirez
f93fbc1c89 Added check for <sys/wait.h> #ifdef'ed the SIGSYS block of code, since
some platforms (Linux) don't have SIGSYS. Linux's rationalization is that
SIGSYS is not a POSIX-defined signal.

svn path=/trunk/; revision=743
1999-09-30 16:24:07 +00:00
Guy Harris
4423330034 If we specify a save file name with "-w", mark it as "user saved", so
that we don't delete it if we later start a new capture.

svn path=/trunk/; revision=742
1999-09-30 07:19:35 +00:00
Guy Harris
58609193d0 When we get an EOF on the sync pipe in sync mode, wait for the child to
exit, so that it doesn't hang around as an unreaped zombie until the
parent exits, and, if it stopped or terminated due to a signal, report
that in a message box.

svn path=/trunk/; revision=741
1999-09-30 07:15:19 +00:00
Guy Harris
bab015f5e5 Add a new global flag "capture_child", which is TRUE if we're a child
process for a sync mode or fork mode capture.

Have that flag control whether we do things that *only* the parent or
*only* the child should do, rather than basing it solely on the setting
of "sync_mode" or "fork_mode" (or, in the case of stuff done in the
child process either in sync mode or fork mode, rather than basing it on
the setting of those flags at all).

Split "do_capture()" into a "run_capture()" routine that starts a
capture (possibly by forking off and execing a child process, if we're
supposed to do sync mode or fork mode captures), and that assumes the
file to which the capture is to write has already been opened and that
"cf.save_file_fd" is the file descriptor for that file, and a
"do_capture()" routine that creates a temporary file, getting an FD for
it, and calls "run_capture()".

Use "run_capture()", rather than "capture()", for "-k" captures, so that
it'll do the capture in a child process if "-S" or "-F" was specified
("do_capture()" won't do because "-k" captures should write to the file
specified by the "-w" flag, not some random temporary file).

For child process captures, however, just use "capture()" - the child
process shouldn't itself fork off a child if we're in sync or fork mode,
and should just write to the file whose file descriptor was specified by
the "-W" flag on the command line.

All this allows you to do "ethereal -S -w <file> -i <interface> -k" to
start a sync mode capture from the command line.

svn path=/trunk/; revision=740
1999-09-30 06:50:01 +00:00
Guy Harris
062cb007f1 If we're given the "-k" flag, don't start the capture until after we've:
popped up the top-level window (so that it looks like a capture
	started from "Capture/Start");

	initialized the colors (so that we don't dump core when reading
	in the capture file);

	popped up any message box for failure to read the preferences
	file.

This means we start the capture in "main()", rather than in the realize
callback for the main window, so get rid of that callback.

If we're a child process that's just capturing to a file for our parent
to read, however, we shouldn't pop up the top-level window, because
that's our parent's job; when running that child, set its "argv[0]" to a
special name, so that

	1) it shows up in a "ps" with a special name;

	2) we don't have to invent Yet Another Flag to say "you're the
	   child".

(We may want to use the name to turn on *all* behaviors that the capture
child, and only the capture child, should exhibit.)

If "-w" and "-k" were both specified, attempt to open the file specified
by "-w" and, if that succeeds, set "cf.save_file_fd" to refer to it, so
that "-w" plus "-k" works again, rather than popping up a "The file to
which the capture would be saved ... could not be opened: Bad file
descriptor." message box.

svn path=/trunk/; revision=739
1999-09-30 06:11:51 +00:00
Guy Harris
7caca1db1d GTK 1.2.5 version (not that it matters, given that GLib declares
"gboolean" to be a typedef of "gint").

svn path=/trunk/; revision=738
1999-09-30 02:57:26 +00:00
Guy Harris
080ddfb691 Enable "Print hex" only if "Print detail" is on.
svn path=/trunk/; revision=737
1999-09-29 22:25:41 +00:00
Guy Harris
e4f7809763 Add an item to the "File/Print" dialog box to ask that the full hex data
of the packet be printed (this is only done if "Print detail" is
selected; it should be grayed out of "Print summary" is selected).

If that item is selected, suppress the hex printing of uninterpreted
data items in the protocol tree.

Move some GTK+ keys not used outside of "gtk/print_dlg.c" from
"gtk/keys.h" into "gtk/print_dlg.c".

svn path=/trunk/; revision=736
1999-09-29 22:19:24 +00:00
Gilbert Ramirez
7b732a9f80 Fixed assert error reported by Dewi Morgan <dewim@sco.com>.
After some bad dfilter parses, the top-level dfilter tree (global_df->dftree)
would erroneously be set to the last good dfilter_node that was parsed.
Later, the non-NULLness of the dftree made us clear it.. really confusing
GTK internals. After _that_, new GNodes created via g_node_new() would
all have the same address!

svn path=/trunk/; revision=735
1999-09-29 22:11:51 +00:00