Commit graph

394 commits

Author SHA1 Message Date
Robin Sommer
45f5900547 Merge remote-tracking branch 'origin/topic/jsiwek/load-sigs'
* origin/topic/jsiwek/load-sigs:
  Add @load-sigs directive for loading signature files (addresses #551).

Closes #551.
2012-06-06 11:49:39 -07:00
Jon Siwek
7599ac8f31 Memory leak fixes for bad usages of VectorVal ctor.
Many usages of the VectorVal ctor didn't account for the fact that
it automatically Ref's the VectorType argument and end up leaking it.
2012-06-06 11:50:15 -05:00
Jon Siwek
0bdbeb89e2 Memory leak fixes 2012-06-06 10:41:36 -05:00
Jon Siwek
727b7783f9 Add AYIYA tunnel decapsulation unit test. 2012-06-05 15:17:27 -05:00
Jon Siwek
854c625275 Add Teredo-specific events.
These are called "teredo_packet", "teredo_authentication",
"teredo_origin_indication", and "teredo_bubble" and may be raised
on a per-packet basis depending on Teredo encapsulation method.
2012-06-05 15:07:56 -05:00
Jon Siwek
dd4dd0ca6e Add @load-sigs directive for loading signature files (addresses #551). 2012-06-01 14:10:23 -05:00
Jon Siwek
9fb0065696 Merge branch 'master' into topic/tunnels
Conflicts:
	scripts/base/init-bare.bro
	src/Conn.cc
	src/Conn.h
	src/Sessions.cc
	src/Sessions.h
	src/const.bif
	src/types.bif
2012-05-31 16:13:14 -05:00
Jon Siwek
0aecca979e Remove unnecessary assert in ICMP analyzer (addresses #822).
The ICMP/ICMPv6 analyzers function correctly when full packets have
not been captured, but everything up to and including the ICMP header
is there (e.g. the functions that inspect ICMP error message context
correctly check the caplen to see if more info can be extracted).

The "Should have been caught earlier already." comment may have referred
to NetSessions::CheckHeaderTrunc, which works as intended to catch cases
where the ICMP header is not there in full, but then the assert was
still not correctly formulated for that...

Also changed the ICMP checksum calculation to not occur when the full
packet has not been captured, which seems consistent with what the UDP
analysis does.
2012-05-29 17:29:11 -05:00
Jon Siwek
0d7d74e11b Merge branch 'master' into topic/tunnels 2012-05-22 16:05:06 -05:00
Jon Siwek
5312b21d7b Improve availability of IPv6 flow label in connection records.
Without this change, flow labeling of connections over IPv6 are
only available in the per-packet types of events (e.g. new_packet)
in which header fields can be inspected, but now minimal tracking
of the most recent flow label is done internally and that's available
per-connection for all events that use connection record arguments.

Specifically, this adds a "flow_label" field to the "endpoint" record
type, which is used for both the "orig" and "resp" fields of
"connection" records.  The new "connection_flow_label_changed" event
also allows tracking of changes in flow labels: it's raised each time
one direction of the connection starts using a different label.
2012-05-22 15:18:33 -05:00
Jon Siwek
2108ea0ac1 Merge branch 'master' into fastpath 2012-05-17 15:21:09 -05:00
Jon Siwek
3fedd32f4d Fix mobility checksums unit test.
Was failing because it depended on weirds being sent to stderr.
2012-05-17 14:47:09 -05:00
Robin Sommer
7cc863c5fc Fix for when not producing local output; that hung.
* origin/topic/robin/dataseries:
  Moving trace for rotation test into traces directory.
  Fixing a rotation race condition at termination.
  Portability fixes.
  Extending DS docs with some examples.
  Updating doc.
  Fixing pack_scale and time-as-int.
  Adding format specifier to DS spec to print out double as %.6f.
  DataSeries updates and fixes.
  DataSeries tuning.
  Tweaking DataSeries support.
  Extending log post-processor call to include the name of the writer.
  Removing an unnecessary const cast.
  DataSeries TODO list with open issues/questions.
  Starting DataSeries HowTo.
  Additional test output canonification for ds2txt's timestamps.
  In threads, an internal error now immediately aborts.
  DataSeries cleanup.
  Working on DataSeries support.
  Merging in DataSeries support from topic/gilbert/logging.
  Fixing  threads' DoFinish() method.
2012-05-17 12:38:47 -07:00
Robin Sommer
122f6ee4c6 Moving trace for rotation test into traces directory. 2012-05-16 18:28:51 -07:00
Robin Sommer
99db264775 Portability fixes.
- Fix for time-as-int on 32-bit systems.

    - Skipping ds2txt's index output for test diffing, as it seems
      non-portable.
2012-05-16 18:01:28 -07:00
Robin Sommer
be6567f437 Merge remote-tracking branch 'origin/master' into topic/robin/dataseries 2012-05-14 22:17:26 -07:00
Daniel Thayer
508d39457a Update tests (use weird.log instead of stderr) 2012-05-11 17:09:01 -05:00
Jon Siwek
bbac44a6a4 Changes to open-file caching limits and uncached file unserialization.
- Unserializing files that were previously kicked out of the open-file
  cache would cause them to be fopen'd with the original access
  permissions which is usually 'w' and causes truncation.  They
  are now opened in 'a' mode.  (addresses #780)

- Add 'max_files_in_cache' script option to manually set the maximum
  amount of opened files to keep cached.  Mainly this just helped
  to create a simple test case for the above change.

- Remove unused NO_HAVE_SETRLIMIT preprocessor switch.

- On systems that don't enforce a limit on number of files opened for
  the process, raise default max size of open-file cache from
  32 to 512.
2012-05-03 13:13:58 -05:00
Seth Hall
0c97c3c1de Several final fixes for PacketFilter framework.
- Fixed how the dpd_* variables are written.

- Fixed a bug with the shunting code.

- Updated a few tests.
2012-05-02 21:16:30 -04:00
Jon Siwek
064c5dddb8 Fix for IP tunnel UID persistence. 2012-04-27 10:28:46 -05:00
Jon Siwek
b8e1604ab5 Make tunnels always identifiable by UID, tunnel.log now gets populated.
conn.log now sets a field indicating all the parent tunnel UIDs over
which a connection operated and cross reference the UIDs found in
the tunnel.log.

Also some renaming of tunnel related types at the scripting layer.
2012-04-26 12:29:59 -05:00
Robin Sommer
c91563fe75 DataSeries tuning.
- Now using the new DS interface from git to remove warning.

- New leak tests, not yet tried,
2012-04-24 17:57:05 -07:00
Jon Siwek
b51dd191d7 Refactor IP-in-IP tunnel support.
UDP tunnel support removed for now, to be re-added in specific
analyzers later, but IP-in-IP is now decapsulated recursively
so nested tunnels can be seen and the inner packets get sent
through the IP fragment reassembler if necessary.
2012-04-23 13:15:29 -05:00
Jon Siwek
b933184b25 Changes related to ICMPv6 Neighbor Discovery messages.
- The 'icmp_conn' record now contains an 'hlim' field since hop limit
  in the IP header is an interesting field for at least these ND
  messages.

- Changed 'icmp_router_advertisement' event parameters.
  'router_lifetime' is now an interval. Fix 'reachable_time' and
  'retrans_timer' using wrong internal Val type for intervals.
  Made more of the known router advertisement flags available through
  boolean parameters.

- Changed 'icmp_neighbor_advertisement' event parameters to add
  more of the known boolean flags.
2012-04-18 13:13:56 -05:00
Robin Sommer
5350cab371 Merge remote-tracking branch 'origin/topic/icmp6'
* origin/topic/icmp6:
  Fixes for IPv6 truncation and ICMP/ICMP6 analysis.
  Change ICMPv6 checksum calculation to use IP_Hdr wrapper.
  Update IPv6 atomic fragment unit test to filter output of ICMPv6.
  Add more data to icmp events
  More code cleanup
  Add more icmpv6 events, and general code cleanup
  Fix compile failure after merge from master
  Significant edit pass over ICMPv6 code.
  Porting Matti's branch to git.

Closes #808.
2012-04-17 19:02:59 -07:00
Jon Siwek
51bad73e1e Fixes for IPv6 truncation and ICMP/ICMP6 analysis.
- Add more guards against trying to analyze captured packets with a
  truncated IPv6 static header or extension header chain.

- Add back in the ICMP payload tracking for ICMP "connections".

- Fix 'icmp_context' record construction.  Some field assignments
  were mismatched for ICMP and ICMP6.  Source and destination
  addresses were set incorrectly for context packets that don't
  contain a full IP header.  Some fields for ICMP6 weren't filled out.

- Changed ICMP Time Exceeded packets to raise the 'icmp_time_exceeded'
  event instead of 'icmp_error_message'.

- Add unit tests for truncation and the main types of ICMP/ICMP6
  that have specific events.

- Documentation clarifications.
2012-04-11 16:27:31 -05:00
Robin Sommer
86834c941c Adding missing leak groups to a couple tests.
Also activating leak checking for proxy in basic-cluster test.
2012-04-10 16:14:33 -07:00
Jon Siwek
27ba3118c1 Change ICMPv6 checksum calculation to use IP_Hdr wrapper.
So that src/dst addresses used in pseudo-header are correct when
there's certain extension headers (routing/destination).

Add ICMP/ICMPv6 checksum unit tests.
2012-04-10 11:37:08 -05:00
Jon Siwek
958c6c7cf4 Update IPv6 atomic fragment unit test to filter output of ICMPv6.
Since that's not relevant to test.
2012-04-10 11:09:07 -05:00
Robin Sommer
cccaad63b3 Merge remote-tracking branch 'origin/topic/jsiwek/mobile-ipv6'
* origin/topic/jsiwek/mobile-ipv6:
  Add support for mobile IPv6 Mobility Header (RFC 6275).
  Refactor IP_Hdr routing header handling, add MobileIPv6 Home Address handling.
  Revert TCP checksumming to cache common data, like it did before.
  Revert "Improve handling of IPv6 Routing Type 0 headers."
  Improve handling of IPv6 routing type 0 extension headers.
2012-04-09 17:49:52 -07:00
Jon Siwek
91330f1e1c Add support for mobile IPv6 Mobility Header (RFC 6275).
- Accessible at script-layer through 'mobile_ipv6_message' event.

- All Mobile IPv6 analysis now enabled through --enable-mobile-ipv6
  configure-time option, otherwise the mobility header, routing type 2,
  and Home Address Destination option are ignored.
2012-04-09 14:39:00 -05:00
Jon Siwek
29724415c3 Merge branch 'master' into topic/jsiwek/mobile-ipv6
Conflicts:
	src/IP.cc
2012-04-05 12:05:06 -05:00
Jon Siwek
f3455f843e Merge branch 'master' into fastpath 2012-04-05 11:41:00 -05:00
Jon Siwek
11b15cc290 Refactor IP_Hdr routing header handling, add MobileIPv6 Home Address handling.
Packets that use the Home Address Destination option use that option's
address as the connection's originator.
2012-04-05 10:50:35 -05:00
Jon Siwek
d8d83f590b Fix handling of IPv6 atomic fragments.
The FragReassembler expire_timer was left uninitialized until after
the first fragment is added, but since the atomic fragment is also
the last, the reassembler thought expire_timer needed to be deleted.
This fix just initializes expire_timer before the first fragment is
added.
2012-04-04 15:27:43 -05:00
Jon Siwek
256c0af98e Merge branch 'master' into topic/robin/log-threads
Conflicts:
	cmake
2012-03-30 12:02:32 -05:00
Jon Siwek
256cd592a7 Improve handling of IPv6 Routing Type 0 headers.
- For RH0 headers with non-zero segments left, a "routing0_segleft"
  flow_weird event is raised (with a destination indicating the last
  address in the routing header), and an "rh0_segleft" event can also
  be handled if the other contents of the packet header are of interest.
  No further analysis is done as the complexity required to correctly
  identify destination endpoints of connections doesn't seem worth it
  as RH0 has been deprecated by RFC 5095.

- For RH0 headers without any segments left, a "routing0_header"
  flow_weird event is raised, but further analysis still occurs
  as normal.
2012-03-28 13:49:28 -05:00
Jon Siwek
f4101b5265 Improve handling of IPv6 routing type 0 extension headers.
- flow_weird event with name argument value of "routing0_hdr" is raised
  for packets containing an IPv6 routing type 0 header because this
  type of header is now deprecated according to RFC 5095.

- packets with a routing type 0 header and non-zero segments left
  now use the last address in that header in order to associate
  with a connection/flow and for calculating TCP/UDP checksums.

- added a set of IPv4/IPv6 TCP/UDP checksum unit tests
2012-03-27 16:05:45 -05:00
Jon Siwek
5312a904ab Fix ipv6_ext_headers event and add routing0_data_to_addrs BIF.
Also add unit tests for ipv6_ext_headers and esp_packet events.
2012-03-14 10:31:08 -05:00
Jon Siwek
e74cbbf774 Add unit test for IPv6 fragment reassembly. 2012-03-12 15:26:51 -05:00
Robin Sommer
0208dd2844 Merge remote branch 'origin/master' into topic/robin/log-threads 2012-03-08 17:35:58 -08:00
Robin Sommer
83038d78e0 Adding new leak tests involving remote logging. 2012-03-08 17:35:58 -08:00
Jon Siwek
0b32c980bf Update PacketFilter/Discarder code for IP version independence.
The signatures of script-layer functions 'discarder_check_ip',
'discarder_check_tcp', 'discarder_check_udp', and 'discarder_check_icmp'
were changed to use the more general 'pkt_hdr' type as a parameter
instead of individual header types.
2012-03-08 13:12:04 -06:00
Robin Sommer
92ed583ee7 Adding btest group "leaks" to leak tests.
This will make it easier to run just the leak tests.
2012-02-29 17:19:38 -08:00
Jon Siwek
e07470c7f1 Remove connection compressor (addresses #559). 2012-02-27 11:35:25 -06:00
Jon Siwek
b3f1f45082 Remove --enable-brov6 flag, IPv6 now supported by default.
Internally, all BROv6 preprocessor switches were removed and
addr/subnet representations wrapped in the new IPAddr/IPPrefix classes.

Some script-layer changes of note:

- dns_AAAA_reply event signature changed: the string representation
  of an IPv6 addr is easily derived from the addr value, it doesn't
  need to be another parameter.  This event also now generated directly
  by the DNS analyzer instead of being "faked" into a dns_A_reply event.

- removed addr_to_count BIF.  It used to return the host-order
  count representation of IPv4 addresses only.  To make it more
  generic, we might later add a BIF to return a vector of counts
  in order to support IPv6.

- changed the result of enclosing addr variables in vertical pipes
  (e.g. |my_addr|) to return the bit-width of the address type which
  is 128 for IPv6 and 32 for IPv4.  It used to function the same
  way as addr_to_count mentioned above.

- remove bro_has_ipv6 BIF
2012-02-03 16:46:58 -06:00
Robin Sommer
03b7ebfb5b Merge remote-tracking branch 'origin/topic/jsiwek/fix-dns-double-free'
* origin/topic/jsiwek/fix-dns-double-free:
  Fix double-free of DNS_Mgr_Request object (addresses #661)

Closes #661.
2011-12-01 16:40:07 -08:00
Jon Siwek
4444c56a94 Fix double-free of DNS_Mgr_Request object (addresses #661)
In DNS::Resolve, they could be deleted once from where they were
stored in the nb_dns_info cookie and once again from where they
were stored in the DNS_Mgr::requests list.  Before commit
bd9c937236, they were only deleted
from the requests list, so this commit reverts to that behavior
without any leaks being reported by the core/leaks tests.
2011-11-30 13:31:54 -06:00
Robin Sommer
9aef0c0f5a Fixing packet filter test.
Adapting the IPv6 one as well, though I believe that's already
broken anyway ...
2011-11-03 17:42:06 -07:00
Robin Sommer
c8dfdb4492 Merge remote-tracking branch 'origin/topic/robin/interpreter-exceptions'
* origin/topic/robin/interpreter-exceptions:
  Adding test for new error handling.
  Experimental code to better handle interpreter errors.

This seems to work fine and it catches some potentially nasty crashes
so I'm merging it in even though it's not the final word on error
handling yet. #646 tracks the work scheduled for later.
2011-10-21 10:35:32 -07:00