dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

902 Commits

Author SHA1 Message Date
risso 34023facce Added a missing initialization of pcap_t::timeout when an adapter is opened
with pcap_open_live. This bug caused pcap_setnonblock to misbehave when
the adapter was set to blocking mode.
2005-07-10 17:53:08 +00:00
guy d9d1f9154e select() should work on BPF devices on Tiger; it's poll() and kqueues
that don't work.
2005-07-10 10:54:45 +00:00
hannes e821a5221b fix MPLS code generation:
if we have a MPLS label stack deeper > 1 then generate a match
  for a cleared bottom-of-stack-bit of the previous MPLS shim header
  rather than just incrementing the offset;

if there is a compined expression of MPLS and IP like e.g.
  "mpls && ip" | "mpls && ip host" | "mpls && ip src net"
  then poison the linkoffset to make sure that other code generators
  do not try to match link-layer protos like Q_ARP, Q_RARP etc.

introduce a new function gen_null() that matches against the first nibble
  of the IP header and matches if the bottom-of-stack bit is set;

TODO: IPv6 stuff i.e. gen_host6() etc.
2005-07-08 15:18:59 +00:00
guy 7f34968ee3 From Stephen Donnelly: updates to the DAG support, to support their
updated API if available.
2005-07-07 06:55:19 +00:00
guy 75b14d240d OK, we'll be putting out 0.9.2 soon, so add the API changes back in
again.
2005-07-07 01:57:00 +00:00
guy 5e92dec088 0.9's already been released, so, for better or worse, we're stuck with
the old names.
2005-07-05 22:31:57 +00:00
guy 727beef298 Rename "direction_t" to "pcap_direction_t", and rename "D_IN" and
"D_OUT" to "PCAP_D_IN" and "PCAP_D_OUT", to avoid potential namespace
collisions, as per a suggestion by Dean Gaudet.
2005-07-05 22:12:17 +00:00
mcr 746c2edea7 changes for 3.9. 2005-07-05 21:03:26 +00:00
guy 409a1a06be Rebuild with autoconf 2.57, to minimize changes. 2005-06-29 06:48:06 +00:00
guy 819e96c769 Checking whether the amount of data returned by SIOCGIFCONF is less than
the size of the buffer we handed to it is insufficient to determine
whether we have the entire list of interfaces or not - if the amount of
space left in the buffer after adding an entry is non-zero but less
than the amount of space required by the next entry, the ioctl will stop
before adding the next entry, and not necessarily return an error.

The only way to ensure that we got all the data is to pass a buffer
large enough that the amount of space in the buffer *not* filled in
is greater than the largest possible entry.

We assume that's "sizeof(ifreq.ifr_name)" plus 255, under the assumption
that no address is more than 255 bytes (on systems where the "sa_len"
field in a "struct sockaddr" is 1 byte, e.g. newer BSDs, that's the
case, and addresses are unlikely to be bigger than that in any case).
2005-06-29 06:41:39 +00:00
guy 959719860d The data link layer isn't settable, so get rid of
"septel_set_datalink()".

It's also always the same, so get rid of "septel_get_datalink()".

Add an inject routine that just returns an error.

Get rid of a malloc() whose result was neither used nor freed.

Clean up indentation.
2005-06-21 01:03:03 +00:00
guy 32234cde86 Don't dump core if the user uses "sio", "opc", "dpc", or "sls" on a
non-SS7 device or capture; report an error.
2005-06-20 21:52:33 +00:00
guy 45767ee2d4 Cleanups to help for --with-dag and --with-septel. 2005-06-20 21:36:57 +00:00
guy a0a4852137 From Gilbert Hoyek <gil_hoyek@hotmail.com>: support for capturing SS7
traffic on Intel Septel cards, and for filtering on SS7 MTP3 fields.

Clean up indentation.
2005-06-20 21:27:07 +00:00
risso b1a06c1017 Fixed a leak in pcap_open_live (win32): the pcap_t handle was not freed
if PacketOpenAdapter fails.
[The previous fix was in the wrong place].
2005-06-10 03:52:19 +00:00
risso 5636631e58 Fixed a leak in pcap_open_live (win32): the pcap_t handle was not freed
if PacketOpenAdapter fails.
2005-06-10 03:49:19 +00:00
hannes c8df74b581 bugreport from Paolo Lucente <paolo.lucente@ic.cnr.it>:
the mpls stack processing is broken:
for example "mpls 10000 && mpls 20000" does produce

reading from file ppp.pcap, link-type PPP (PPP)
(000) ldh      [2]
(001) jeq      #0x00000281      jt 2    jf 11
(002) ld       [4]
(003) and      #0xfffff000
(004) jeq      #0x02710000      jt 5    jf 11
(005) ldh      [6]
(006) jeq      #0x00000281      jt 7    jf 11
(007) ld       [8]
(008) and      #0xfffff000
(009) jeq      #0x04e20000      jt 10   jf 11
(010) ret      #1514
(011) ret      #0

the extra match for 0x281 at instruction #6 is broken and
a copy&paste artifact from the vlan code generator, which
in contrast does require the VLAN tag 0x8100 at every instance
inside a VLAN stack;

correct code should be:

(000) ldh      [2]
(001) jeq      #0x281           jt 2    jf 9
(002) ld       [4]
(003) and      #0xfffff000
(004) jeq      #0x2710000       jt 5    jf 9
(005) ld       [8]
(006) and      #0xfffff000
(007) jeq      #0x4e20000       jt 8    jf 9
(008) ret      #1514
(009) ret      #0
2005-06-06 14:10:58 +00:00
guy da6c782f50 Sigh. In OS X 10.4 (and 10.4.1), "select()" and "poll()" don't work on
any character devices, including BPF devices.
2005-06-04 02:51:45 +00:00
guy 98bddc1384 Add a "pcap_dump_ftell()" routine, to fetch the current offset of a
pcap_dumper_t.  (Just doing an "ftell()" on the result of
"pcap_dump_file()" won't necessarily work on Windows, as Microsoft, in
their infinite wisdom, have multiple different versions of the C library
runtime, and if a DLL is built using one version, and another DLL or an
executable is built with another version, file descriptors and FILE *'s
opened in one of them cannot be used in the other.)
2005-06-03 20:36:19 +00:00
guy 3a1174ec74 Put in a note about ISO-over-LLC, PPPoA (which is "PPP-over-LLC using
the ISO NLPID for PPP"), and PPPoE.
2005-05-28 00:29:49 +00:00
guy 4d9af0710d RFC 1483 handles more than just IP and more than just SNAP. 2005-05-27 23:32:20 +00:00
guy e503864143 Note that "pcap_setdirection()" isn't supported on savefiles. 2005-05-23 20:37:30 +00:00
guy 9c2ab752b2 Give a more correct error if you try to set the direction when reading
from a savefile.
2005-05-23 20:30:44 +00:00
hannes 18bb7676da add basic support for DLT_JUNIPER_{GGSN,ES,MONITOR,SERVICES} 2005-05-19 09:33:20 +00:00
hannes ddf0f5f8d9 add basic support for DLT_JUNIPER_PPPOE_ATM 2005-05-12 07:04:22 +00:00
risso 520160b903 Renamed fileno to _fileno under MSVC, to avoid a compiler warning. 2005-05-04 19:40:15 +00:00
risso 3acfaf7f23 Added support for 64 bit integers under Windows. 2005-05-04 19:38:48 +00:00
hannes 94b22ceceb add minimalistic code support for DLT_JUNIPER_PPPOE 2005-05-03 20:31:35 +00:00
guy e987a615e2 From Pawel Pokrywka: add support for requesting that only received
packets, only sent packets, or all packets be accepted, with an
implementation for Linux.

Add an implementation for BPF platforms that support BIOCSSEESENT.
2005-05-03 18:53:58 +00:00
guy a27ec87482 Fix a bunch of places to support all the 802.11+radio header DLT_ values
where DLT_IEEE802_11 is supported.
2005-05-02 21:22:34 +00:00
guy 875df1a937 Make "link[N:M]" refer to the 802.11 header for all 802.11 DLT_ values,
including those with fixed-length radio headers (it already refers to
the 802.11 header for radiotap).

Add a new "radio" keyword, to allow access to the radio header.  In
theory, something to allow testing for specific signal strengths, etc.
might be useful, but radiotap makes that difficult as the code can't
loop through the header looking for the signal strength field, the loop
has to be unrolled, and some of the other headers might not have
standardized the meaning of some of the fields, so we require the user
to construct such a filter themselves, for now.
2005-05-02 21:13:08 +00:00
guy 37bd0411b4 Get rid of a redundant test (if we're in that branch of code, we've set
fp to stdin, so we know it's equal to stdin), and update a comment.
2005-05-01 19:57:31 +00:00
guy 9942a5dd4a Clean up white space. 2005-05-01 19:53:11 +00:00
guy 8561645aa2 Add the SS7 encapsulations to pcap-bpf.h, replacing the unused "raw SS7"
encapsulation with an "MTP2 plus pseudo-header" encapsulation.  Get rid
of "rawss7.h", as the LINKTYPE_RAWSS7 it's mainly dedicated to explain
was never implemented.  Update savefile.c for the changes.
2005-05-01 19:46:27 +00:00
guy 574c8c863c Add support for most filter operations for captures with the radiotap
header.

Handle MAC broadcasts with the AVS and Prism header as well.
2005-05-01 19:32:38 +00:00
guy bd90260840 Use "gen_load_ipxhdrlen()" in more places. 2005-05-01 09:17:45 +00:00
guy 94f7e7a5ed Add a routine to load into the X register the length of the IPv4 header. 2005-05-01 09:05:01 +00:00
guy 6804103187 Make the value argument to "gen_ncmp()" a bpf_int32, the same as the
value arguments are to other routines.  Do the same with the value
argument to "gen_atmfield_code()".

"gen_load_a()" can return more than one statement; append to the list of
statements it returns with "sappend()", rather than manually appending
to the first statement.

Fix the argument list to one "gen_ncmp()" call, and get rid of the casts
in the other calls, as the arguments already have the right types.

Fix the casts in calls to "gen_atmfield_code()".
2005-05-01 08:37:04 +00:00
guy eeadab8760 Replace all the "gen_load_*rel()" routines with "gen_load_a()", which
takes an argument indicating what the offset is relative to.

Make the various comparison generators take an argument of that sort as
well.

Tweak the arguments to "gen_ncmp()" to match those of the other
comparison routines, and make all the other comparison routines just
call "gen_ncmp()".
2005-05-01 04:13:52 +00:00
guy 4a81b9fad7 Add a routine to generate code to load a value relative to the beginning
of the transport-layer header, where the network layer is an IPv6
header, and use that.
2005-05-01 00:55:42 +00:00
guy 9b461d662c Add routines to generate code to load values relative to the beginning
of the link-layer, network-layer, and transport-layer (assuming the
network layer is IPv4) headers.  This makes it a bit clearer what stuff
would be changed for variable-length link-layer headers or
variable-length pseudo-headers before the link-layer header.
2005-05-01 00:38:01 +00:00
risso 8c2c2e8bdb Fixed the definition of SET_BINMODE(): the correct flag under VC6 is
_O_BINARY (which is accepted by Cygwin, as well).

Moved SET_BINMODE while reading from stdin *before* reading the savefile
header.
2005-04-26 00:54:23 +00:00
guy 9f021f0abe "gen_portatom()" and "gen_portatom6()" are declared as static; define
them as static as well.
2005-04-25 18:58:05 +00:00
guy feedc6fe89 From Albert Chin: AC_CHECK_DECLS will define the HAVE_DECL_xxx variable
whether it succeeds or fails, so you can't erase a "no" result and try
again with a different header.  Use AC_CHECK_DECL, which doesn't define
HAVE_DECL_xxx, and then explicitly define it based on whether we found a
declaration or not.
2005-04-23 22:43:15 +00:00
guy 022b629ab1 From Albert Chin: just define __attribute__ as an empty macro if we
don't have __attribute__ support in the compiler.

While we're at it, get rid of the declaration of bpf_error() in
gencode.c, as it's already declared in gencode.h.
2005-04-23 22:26:51 +00:00
guy 4eb7b3915e AC_TRY_COMPILE works only for code that fits inside "main()"; the test
for __attribute__ doesn't fit inside "main()" with GCC 4.0, as it
defines a function.
2005-04-21 03:41:24 +00:00
guy b51227ccf4 Include <sys/cfgodm.h> rather than <odmi.h> in the hopes that it'll
suppress some compiler warnings (and work on AIX 4.3 as well as 5.x).
2005-04-21 02:41:12 +00:00
guy 50ba231733 Get rid of an unused variable. 2005-04-20 18:23:09 +00:00
guy eeaf96fb94 Some systems (*cough*Irix*cough) not only don't declare
"ether_hostton()" but don't even declare "struct ether_addr"; on those
systems, declare "struct ether_addr".
2005-04-20 11:12:36 +00:00
guy 24c3633894 <string.h> is the ANSI C standard header file to include for various
routines, including malloc() and company - and for string routines used
in this file, which aren't necessarily declared in <memory.h>, so
include <string.h>.
2005-04-20 10:37:32 +00:00