Commit Graph

785 Commits

Author SHA1 Message Date
Guy Harris 3b9013d393 When a new display filter is to be applied, don't set "cf.dfilter" or
"cf.dfcode" if the new filter doesn't compile, because the filter
currently in effect will be the one that was last applied - just free up
the text of the new filter, and whatever memory was allocated for the
new filter code.

This means we allocate a new dfilter when a new filter is to be applied,
rather than recycling stuff from the old filter, as we want the old
filter code to remain around if the new filter doesn't compile.

This means that "cf.dfilter" and "cf.dfcode" will be null if there's no
filter in effect.

svn path=/trunk/; revision=803
1999-10-11 06:39:26 +00:00
Guy Harris 29b9c8a285 Have "get_host_ipaddr()" return a Boolean indicating whether it
succeeded or failed, and, if it succeeded, have it fill in the IP
address if found through a pointer passed as the second argument.

Have it first try interpreting its first argument as a dotted-quad IP
address, with "inet_aton()", and, if that fails, have it try to
interpret it as a host name with "gethostbyname()"; don't bother with
"gethostbyaddr()", as we should be allowed to filter on IP addresses
even if there's no host name associated with them (there's no guarantee
that "gethostbyaddr()" will succeed if handed an IP address with no
corresponding name - and it looks as if FreeBSD 3.2, at least, may not
succeed in that case).

Add a "dfilter_fail()" routine that takes "printf()"-like arguments and
uses them to set an error message for the parse; doing so means that
even if the filter expression is syntactically valid, we treat it as
being invalid.  (Is there a better way to force a parse to fail from
arbitrary places in routines called by the parser?)

Use that routine in the lexical analyzer.

If that error message was set, use it as is as the failure message,
rather than adding "Unable to parse filter string XXX" to it.

Have the code to handle IP addresses and host names in display filters
check whether "get_host_ipaddr()" succeeded or failed and, if it failed,
arrange that the parse fail with an error message indicating the source
of the problem.

svn path=/trunk/; revision=802
1999-10-11 03:03:12 +00:00
Guy Harris 5779d0b754 The #defines to turn "yy{lex,error}" into names specific to the
parser/lexical analyzer in question are needed only in the ".c" files
for the generated parser and lexical analyzer, and Flex and Byacc/Bison
put them there; don't bother putting them in a header file, just
directly declare the functions with the right names.

svn path=/trunk/; revision=801
1999-10-10 18:16:43 +00:00
Laurent Deniel 79019e8369 Add reference to tcpdump manual page for capture filter syntax.
svn path=/trunk/; revision=800
1999-10-10 16:25:28 +00:00
Laurent Deniel a7e879775e Add display filters.
svn path=/trunk/; revision=799
1999-10-10 16:09:33 +00:00
Richard Sharpe 42b64a7584 Big bunch of fixes to packet-smb.c for things I need.
Also added first pass of state keeping. I am using glib's hash
functions.

Modelled after packet-ncp.c.

We will need to standardize the <proto>_init_protocol functions called in
file.c at some stage ...

I will have a couple of more goes at the state keeping before I am finished.
At the moment, the infrastructure is there but I do nothing with it.

svn path=/trunk/; revision=798
1999-10-10 11:50:45 +00:00
Gilbert Ramirez 8cdaeb0adc Changed the macro XDLC_HAS_PAYLOAD(control) to look at only the first
bit of 'control' to check to see if it's an information frame:

#define XDLC_HAS_PAYLOAD(control) \
        (((control) & 0x1) == XDLC_I || (control) == (XDLC_UI|XDLC_U))

I had erroneously AND'ed with 0x3 when I first put the AND in there.

svn path=/trunk/; revision=797
1999-10-10 03:59:29 +00:00
Laurent Deniel 8333e3b3cf Fix a typo in error message.
svn path=/trunk/; revision=796
1999-10-09 14:14:53 +00:00
Laurent Deniel 69cc7f5b6b - fix a segmentation violation with big "match selected" filters.
- fix a memory leak.

svn path=/trunk/; revision=795
1999-10-09 14:05:04 +00:00
Laurent Deniel d140e8d7c7 Add display filters.
svn path=/trunk/; revision=794
1999-10-09 13:31:30 +00:00
Laurent Deniel 30a10446da - dissect data if type unknown
- add display filters

svn path=/trunk/; revision=793
1999-10-09 13:05:55 +00:00
Laurent Deniel bedd4c9d82 - correct bound checkings in string parsing
- add display filters

svn path=/trunk/; revision=792
1999-10-09 11:56:15 +00:00
Guy Harris 73729dd8b8 The abbreviation for a protocol is generally all-lower-case, as it's
used as a display filter to match all packets that contain data for that
protocol.

svn path=/trunk/; revision=791
1999-10-08 21:20:23 +00:00
Guy Harris 93b7dfe367 Christophe Tronche's BPDU dissector.
svn path=/trunk/; revision=790
1999-10-08 20:50:39 +00:00
Laurent Deniel 0b88b72377 Add display filters.
svn path=/trunk/; revision=789
1999-10-08 13:57:31 +00:00
Guy Harris 05af0607de Move some definitions of stuff not used outside the Lucent/Ascend
capture file reading code from "ascend.h" to "ascend-int.h".

svn path=/trunk/; revision=788
1999-10-08 07:45:31 +00:00
Guy Harris 21f0e54e7f Add an "ascend-int.h" file, to declare routines used by more than one of
the files in the Lucent/Ascend capture file code.

svn path=/trunk/; revision=787
1999-10-08 07:41:33 +00:00
Guy Harris 50f137829c Include "main.h", to pull in the external declarations of several
routines defined in this file.

svn path=/trunk/; revision=786
1999-10-08 07:31:10 +00:00
Guy Harris 07790d8e19 Fix the include-guard #define to be "__MAIN_H__", matching the name of
the file.

svn path=/trunk/; revision=785
1999-10-08 07:29:42 +00:00
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