Commit graph

80 commits

Author SHA1 Message Date
Johanna Amann
6d612ced3d Mark one-parameter constructors as explicit & use override where possible
This commit marks (hopefully) ever one-parameter constructor as explicit.

It also uses override in (hopefully) all circumstances where a virtual
method is overridden.

There are a very few other minor changes - most of them were necessary
to get everything to compile (like one additional constructor). In one
case I changed an implicit operation to an explicit string conversion -
I think the automatically chosen conversion was much more convoluted.

This took longer than I want to admit but not as long as I feared :)
2018-03-27 07:17:32 -07:00
Johanna Amann
1f2bf50b49 Remove unimplemented & unused functions from header files.
All of these functions were defined in header files without ever being
implemented or used.
2018-03-16 18:38:04 -07:00
Daniel Thayer
e198fba2d9 Fix a build failure on OpenBSD
The definition of a "struct pcap_pkthdr" on OpenBSD contains a member
of type "struct bpf_timeval" instead of "struct timeval" used on other
systems.

Also, on OpenBSD the header netinet/if_ether.h does not #include
net/if_arp.h as it does on other systems.
2016-11-29 14:20:43 -06:00
Robin Sommer
420bef58aa Fixing a CMake dependency issue for the pcap bifs.
ninja said:

    ninja: warning: multiple rules generate
    scripts/base/bif/const.bif.bro. builds involving this target will
    not be correct; continuing anyway [-w dupbuild=warn]

Looks like there's a larger problem here involving *.bif of the same
name at different locations of the source tree. For now, I'ved fixed
this one by merging src/iosource/pcap/{const,functions}.bif into
pcap.bif.
2016-08-01 09:20:54 -07:00
Johanna Amann
971f7e236f Fix a number of documentation building errors 2016-06-27 12:41:40 -07:00
Robin Sommer
e69f7f85d1 Merge branch 'topic/jgras/802-11-header' of https://github.com/J-Gras/bro
Added one more range check.
2016-06-14 17:31:08 -07:00
Jan Grashoefer
75849f8fe2 Improved handling of 802.11 headers.
Frame types except data and frames subtypes without payload are skipped.
Header length is determined based on presence of QoS and flags
indicating the use of the 4th address field. Handling of aggregated
MSDUs is explicitly prevented.
2016-06-14 17:52:34 +02:00
Robin Sommer
cfe9ba28dd Guarding against reading beyond packet data when accessing L2 address
in Radiotap header.

This is temporary until we clean up the preceding length check.
2016-06-07 15:59:02 -07:00
Robin Sommer
d59bb2e9d1 Merge branch 'topic/jgras/mac-logging' of https://github.com/J-Gras/bro
Thanks! I've tweaked this a bit further, have a look.

BIT-1613 #merged
2016-06-06 17:59:34 -07:00
Johanna Amann
44b3ece440 Fix coverity error (uninitialized variable) 2016-06-06 13:19:17 -07:00
Johanna Amann
800eda4796 Fix FreeBSD/OSX compile problem due to headers 2016-06-02 16:38:40 -07:00
Jan Grashoefer
50cf694aae Moved link-layer addresses into endpoints.
The link-layer addresses are now part of the connection endpoints
following the originator-responder-pattern. The addresses are printed
with leading zeros. Additionally link-layer addresses are also extracted
for 802.11 plus RadioTap.
2016-06-02 01:46:26 +02:00
Robin Sommer
57aef6d49f Add MAC addresses to connection record.
c$eth_src and c$eth_dst now contain the Ethernet address if available.
A new script protocols/conn/mac-logging.bro adds these to conn.log
when loaded.
2016-05-29 17:18:47 -07:00
Robin Sommer
3581ead0d9 Ignoring packets with negative timestamps.
These used to stall Bro. Addresses BIT-1562 and BIT-1443.
2016-05-23 13:22:22 -07:00
Vitaly Repin
cd2ec7c495 Unknown data link type error message printed out props.link_type instead of arg_props.link_type. It lead to the meaningless and misleading output (E.g.: 'unknown data link type 0xffffffff') 2016-04-28 11:10:52 +03:00
Jan Grashoefer
c0bf1b3c67 Added get_current_packet_header bif. 2016-04-20 00:00:47 +02:00
Johanna Amann
072a3fa28d Merge remote-tracking branch 'origin/topic/seth/radiotap'
BIT-1526 #merged

* origin/topic/seth/radiotap:
  Improved Radiotap support and a test.
  Fixed RadioTap support (still "Works for Me")
  Initial commit of RadioTap encapsulation support)
2016-01-20 17:45:25 -08:00
Seth Hall
88f2a066ce Improved Radiotap support and a test.
Radiotap support should be fully functional now with Radiotap
packets that include IPv4 and IPv6.  Other radiotap packets are
silently ignored.  This includes a test which has 802.11 headers
both with and without QoS data.
2016-01-19 04:10:44 -05:00
Seth Hall
7d5acfd8c8 Merge remote-tracking branch 'origin/master' into topic/seth/radiotap 2016-01-18 12:17:07 -05:00
Seth Hall
f88f3b56f5 Fixed a format specifier. 2016-01-16 23:44:05 -05:00
Robin Sommer
c22a6f67d2 Use better data structure for storing BPF filters. 2015-11-23 19:55:02 -08:00
Robin Sommer
a6b884e764 Removing pcap options for AF_PACKET support.
Turns out that's not working. Addresses BIT-1363.
2015-10-23 15:06:02 -07:00
Seth Hall
1d94eadd36 Fixed RadioTap support (still "Works for Me") 2015-10-17 03:09:12 -04:00
Seth Hall
d6c89ae022 Merge branch 'master' into topic/seth/radiotap
# Conflicts:
#	src/iosource/PktSrc.cc
2015-10-16 16:59:23 -04:00
Robin Sommer
0494a6d882 Merge remote-tracking branch 'origin/topic/johanna/bit-1463'
* origin/topic/johanna/bit-1463:
  Refactor oob tests using different approach.
  Add a number of out_of_bound checks to Packet.cc

BIT-1463 #merged
2015-08-31 14:35:49 -07:00
Johanna Amann
8763e1a485 Refactor oob tests using different approach. 2015-08-31 13:45:00 -07:00
Johanna Amann
fd6f9e470f Add a number of out_of_bound checks to Packet.cc
Mostly this verifies that we actually have the full headers that we are
trying to read in a packet.

Addresses BIT-1463
2015-08-31 13:09:18 -07:00
Robin Sommer
36b5a4db08 Merge branch 'master' of https://github.com/knielander/bro
I reworked this a bit:

    - Moved the globals into a new Pcap::* namespace, and renamed them
      slightly.

    - Moved the definitions of the globals into pcap/const.bif.

    - Also moved the existing 'snaplen' into Pcap::* and removed
      SnapLen() from the PktSrc API (it's really a pcap thing).

    - Likewise moved the existing functions precompile_pcap_filter,
      install_pcap_filter, and pcap_error, into Pcap::*.

    - Did some more refactoring for the pcap code.

* 'master' of https://github.com/knielander/bro:
  Refactored patch (removed options, less ambiguous name)
  Allow Bro to run in fanout mode.
  Allow libpcap buffer size to be set manually.
  Allow Bro to run in fanout mode.
  Allowed libpcap buffer size to be set via configuration.
2015-08-30 22:09:32 -07:00
Kris Nielander
ba4c816b0e Refactored patch (removed options, less ambiguous name) 2015-08-24 23:45:21 +02:00
Kris Nielander
d8c9b7255e Allow Bro to run in fanout mode. 2015-08-09 22:45:23 +02:00
Kris Nielander
f5429ee794 Allow libpcap buffer size to be set manually. 2015-08-09 22:45:09 +02:00
Robin Sommer
8fc44e7e86 CID 1312751: Removing redundant assignment. 2015-08-07 13:10:08 -07:00
Robin Sommer
3957091e1b Renaming config.h to bro-config.h.
A couple times now I had this conflicting with files of the same name
in other projects.
2015-07-28 11:57:04 -07:00
Robin Sommer
fb848f795d Merge branch 'master' of https://github.com/aaronmbr/bro
* 'master' of https://github.com/aaronmbr/bro:
  Copy-paste issue
  Allow for logging of the VLAN data about a connection in conn.log
  Save the inner vlan in the Packet object for Q-in-Q setups
2015-07-23 13:05:28 -07:00
Aaron Brown
f29dbb90a5 Allow for logging of the VLAN data about a connection in conn.log 2015-07-22 14:13:17 -04:00
Aaron Brown
d76c7a2657 Save the inner vlan in the Packet object for Q-in-Q setups 2015-07-22 12:52:10 -04:00
Robin Sommer
f97b2b180c Moving the remaining code from Layer2.* into Packet.* and documenting
the Packet API.

Plus, some more cleanup, including removing a legacy option
time_machine_profiling.
2015-07-21 08:30:23 -07:00
Robin Sommer
f69edd1437 Adding missing files. 2015-07-20 16:49:03 -07:00
Robin Sommer
c72d191ab5 Refactoring L2 parsing code to reside in the Packet class.
That way it can be reused more easily. This also avoid having to
change the serialization structure for packets, which is a problem as
external sources of packets (via Broccoli) wouldn't have the new
attributes available to send.

Also moving Packet.{h,cc} and Layer2.{h,cc} into iosource/, and
removing header size from properties that packet sources have to
provide, as we can now compute that easily from the link type.

Plus some more cleanup.
2015-07-20 16:21:34 -07:00
Robin Sommer
64a478dbd5 Determining final L3 layer protocol right inside PktSrc. 2015-07-17 21:44:42 -07:00
Robin Sommer
86440e44fc Adding more cross-checks for IP.
This prevents a few more packets from reaching raw_events(), see
baseline update for the corresponding test.
2015-07-17 13:59:12 -07:00
Robin Sommer
fe3579f1b4 Merge branch 'topic/rework-packets' of https://github.com/jsbarber/bro
* 'topic/rework-packets' of https://github.com/jsbarber/bro:
  One more tinker to Packet -- ensure no uninitialized values
  Packet::IP()-created IP_Hdr should not free
  Make enums work for non-C++11 config
  Refactor to make bro use a common Packet object. Do a better job of parsing layer 2 and keeping track of layer 3 proto. Add support for raw packet event, including Layer2 headers.

Conflicts:
	aux/plugins
2015-07-17 12:56:04 -07:00
Robin Sommer
476a5dbc34 Merge remote-tracking branch 'origin/topic/jsiwek/bit-1408'
BIT-1408 #merged

* origin/topic/jsiwek/bit-1408:
  BIT-1408: improve I/O loop and Broker IOSource.
2015-06-04 14:46:30 -07:00
Jon Siwek
58ea1ff458 BIT-1408: improve I/O loop and Broker IOSource. 2015-06-03 08:25:49 -05:00
Jeff Barber
30fdc37479 Refactor to make bro use a common Packet object.
Do a better job of parsing layer 2 and keeping track of layer 3 proto.
Add support for raw packet event, including Layer2 headers.
2015-05-29 10:37:39 -04:00
Robin Sommer
0620bc970a Make sure to always delete the remote serializer.
There were two problems actually: the iomanager wasn't properly
deleting sourcesl; and in some situations, the remote serialize wasn't
registered with it to begin with.

Addresses BIT-1306 and probably also BIT-1356.
2015-04-10 21:51:44 -07:00
Daniel Thayer
eec7f77913 Correct a spelling error 2015-03-18 16:39:06 -05:00
Robin Sommer
e5adc768cc Merge branch 'stats-bytes-recvd' of https://github.com/msmiley/bro 2015-03-04 13:16:19 -08:00
Mike Smiley
3877b3e34b add bytes recvd to Stats and stats.bro
use libpcap packet hdr.len to count bytes
2015-02-23 21:27:28 -05:00
Robin Sommer
d29679484d Removing dependency on PCAP_NETMASK_UNKNOWN to compile with libpcap <
1.1.1.
2015-02-20 13:49:58 -08:00