dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

174 Commits

Author SHA1 Message Date
guy 7497ed25c3 Add off_ll to off_nl in cases where that's required and that we missed
in earlier checkins, now that off_nl no longer includes off_ll.

Add in more comments explaining what we're doing.
2006-09-13 07:36:19 +00:00
guy dd84e1c988 Propagate from the main branch:
revision 1.266
	date: 2006-03-16 08:46:13 +0000;  author: hannes;  state: Exp;  lines: +3 -5
	use gen_linktype() rather than a plain gen_cmp() for creating
	the link-layer specific match code for MPLS packets
2006-09-13 07:04:07 +00:00
guy bc6f4cb8a6 Propagate from the main branch:
revision 1.265
	date: 2006-03-16 08:42:14 +0000;  author: hannes;  state: Exp;  lines: +3 -2
	OR_PACKET should match at the beginning of the packet and not at
	the beginning of the packet plus variable-length link-layer
2006-09-13 07:02:15 +00:00
guy bc022c53df Make off_linktype, off_nl, and off_nl_nosnap *not* include off_ll.
Make gen_load_llrel() add in off_ll if there isn't a variable-length
radio header, so the offset passed to it is always relative to the
beginning of the link-layer header, not the beginning of the packet.
Don't add in off_ll when calling it.

Those changes centralize the addition of off_ll, so it's only done in
one place (rather than twice, where it was done before, meaning that the
offsets were wrong for the Prism and AVS headers as they had 2*off_ll
rather than just off_ll, as off_ll was added twice).
2006-09-13 06:57:07 +00:00
guy 8bdc90b418 C89 says that the result of shifting an N-bit value by >= N bits is
undefined; we want it to be zero, so we explicitly check for a 32-bit
shift count and clear the netmask in that case.
2006-05-28 20:13:42 +00:00
hannes bea26c188b code cosmetics: clean up some if() chains and replace by switch() statements 2006-02-22 10:39:49 +00:00
hannes 28fb0bef8c code cosmetics: clean up some if() chains and replace by switch() statements 2006-02-22 10:23:19 +00:00
hannes 2d41d513cb add DLT/LINKTYPE for carrying FRF.16 Multi-link Frame Relay 2005-12-13 13:48:37 +00:00
guy f61b55ff8b Make the "applied to" errors say "applied to net" if we're applying
bogus keywords to "net" rather than "host".
2005-11-17 04:50:13 +00:00
guy 279d705cd1 Add "pppoed" and "pppoes" keywords, for PPPoE Discovery and Session
packets (based on the Ethernet type).  "pppoes" has the side-effect that
subsequent filter expressions will test the PPP header and headers
in the PPP payload, not the link-layer header and headers in the
link-layer payload.
2005-09-05 09:08:03 +00:00
guy ef309163d8 When checking for VLAN packets, check the type field in the Ethernet
header, not the VLAN header.
2005-08-31 06:50:01 +00:00
hannes fcc5e2ecfb allocate 4 new DLTs on behalf of Juniper Networks, Inc. for
prepending meta-information like interface index, interface name
before a standard Ethernet, PPP, Frame Relay, C-HDLC Frame
2005-08-13 22:29:44 +00:00
guy ddcbbde8bb The "is_mpls" Boolean isn't necessary - we can just check the MPLS label
stack depth to see whether we're processing MPLS-encapsulated packets or
not.
2005-08-08 07:25:22 +00:00
guy d845992a55 When we're processing MPLS-encapsulated packets, don't set off_linktype
to -1, set a "we're doing MPLS" flag, and check that flag rather than
checking for an off_linktype of -1; off_linktype can be -1 for reasons
having nothing to do with MPLS (e.g., a DLT_ of DLT_RAW), and those
should be handled as they have traditionally been.

Rename "gen_null()" to "gen_mpls_linktype()" to make it clearer what it
does (it checks the MPLS stack as well as the IP header).
2005-08-08 02:40:05 +00:00
guy c8b15f67a1 From OpenBSD: fix a comment. 2005-07-31 19:02:32 +00:00
hannes c632b6266c add basic support for DLT_JUNIPER_MFR 2005-07-20 15:20:20 +00:00
hannes 20937040b8 per suggestion from Paolo Lucente <paolo.lucente@ic.cnr.it>:
centralize the MPLS check into gen_linktype() and backout the
  specific checks in gen_proto_abrev(), gen_proto(), gen_host()

  this adds as a by-product support for IPv6
2005-07-14 16:01:46 +00:00
hannes 08fbef913e bugreport from Paolo Lucente <paolo.lucente@ic.cnr.it>:
-catch the case where the expression is "mpls && vlan" or a similar mutation
   and generate an error - contrary "vlan && mpls" is perfectly fine;
2005-07-11 13:58:52 +00:00
hannes d6fc76f341 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:27:06 +00:00
guy e4f76eba56 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:53 +00:00
guy 0fe04f098e 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:30:13 +00:00
hannes 8b719a55ac 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:14:01 +00:00
guy a42e5249d2 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:30:21 +00:00
hannes d0e62b4eb2 add basic support for DLT_JUNIPER_{GGSN,ES,MONITOR,SERVICES} 2005-05-19 10:05:31 +00:00
hannes 5496c3bd84 add basic support for DLT_JUNIPER_PPPOE_ATM 2005-05-12 07:06:14 +00:00
hannes 8967214d9c add minimalistic code support for DLT_JUNIPER_PPPOE 2005-05-03 20:33:51 +00:00
guy ec356682a8 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:57 +00:00
guy c04804d259 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:38 +00:00
guy a27315a887 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:33:11 +00:00
guy b06ba3a4e4 Use "gen_load_ipxhdrlen()" in more places. 2005-05-01 09:18:08 +00:00
guy 98b22a19e0 Add a routine to load into the X register the length of the IPv4 header. 2005-05-01 09:05:30 +00:00
guy 27cd2f8c65 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:48 +00:00
guy 8b9f740d4c 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:14:15 +00:00
guy 800ef10d8c 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:56:07 +00:00
guy 52cbb102dc 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:34 +00:00
guy fa82a02ff2 "gen_portatom()" and "gen_portatom6()" are declared as static; define
them as static as well.
2005-04-25 18:59:20 +00:00
guy f2c4434b82 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:27:37 +00:00
guy c1a49ecabc Get rid of an unused variable. 2005-04-20 18:23:42 +00:00
guy 73ce1b460d From Patrick Marie <mycroft@virgaria.org>: add support for port ranges
in tests - "portrange X-Y" matches all ports in the range [X,Y].

Support added for port ranges with IPv6.

Fix some comments.
2005-04-19 04:26:06 +00:00
guy fbfcab3706 Declare "bpf_error()" as "__attribute__((noreturn))" to squelch some
compiler warnings with GCC 4.0.
2005-04-18 22:40:14 +00:00
guy 0f91287474 Put in a comment explaining what "gen_proto()" does.
What it does includes checking whether the packet is of the type
specified by the <proto> argument, so there's no need to add such a
check when checking whether the ISO protocol type field has a particular
value; remove the extra check against the ISO protocol.

Fix a typo in a comment.
2005-04-15 04:45:38 +00:00
hannes 4e10a0f84f backport the changes over the weekend from HEAD to 0_9 2005-04-10 18:04:47 +00:00
hannes 09bff24188 backport for hierarchical vlan, mpls expressions 2005-04-09 18:16:50 +00:00
hannes 2bb9a4c5bd fix offset calculation for iso/isis/clnp/esis over DLT_EN10MB 2005-04-08 15:33:58 +00:00
hannes cba69f4084 -add support for llc based protocols (iso, etc..) for ethernet
by checking the proto against the ethermtu and bumping
 the link-layer offset by two.

-add support for vlan and mpls hierarchies by not absolute
  setting offsets but rather incrementing them;

  example(s):

  mpls 100000 && mpls 1024
    =filters for outerlabel 100000 and inner label 1024
  vlan 100 && vlan 200
    =filters for vlan 200 encapsulated withing vlan 100
  vlan 300 && mpls 17
    =filters for mpls label 17 encapsulated in vlan 300
2005-04-08 14:40:38 +00:00
guy be07cb1988 At the request of Daniele Orlandi, add DLT_LAPD and LINKTYPE_LAPD for
raw LAPD.
2005-04-07 20:42:45 +00:00
guy b3f8e4f640 Squelch some compiler warnings. 2005-03-27 22:10:23 +00:00
guy afe114b070 For "ether proto", allow LLC value names as well as Ethernet type value
names, so that, as the tcpdump man page claims to be the case, "ether
proto \{iso,stp,ipx,netbeui}" are equivalent to "{iso,stp,ipx,netbeui}".
2005-03-17 07:02:31 +00:00
guy c1401d4725 The DLT_LINUX_PPP_WITHDIRECTION is also used for pppd on some BSDs, so
rename it again to DLT_PPP_PPPD, and rename other #defines to match.

Add backwards-compatibility #defines of DLT_PPP_WITH_DIRECTION and
DLT_LINUX_PPP_WITHDIRECTION for software that used them.
2005-02-08 19:52:18 +00:00
guy d9e0597103 Rename DLT_PPP_WITHDIRECTION to DLT_LINUX_PPP_WITHDIRECTION, as it's a
Linux-specific mechanism, and rename other #defines accordingly.  Give
more details about it in comments.
2005-01-31 01:47:27 +00:00