Commit graph

308 commits

Author SHA1 Message Date
Jon Siwek
8792f5545c Fix crash when modifying a table from within its &expire_func 2018-10-12 08:35:25 -04:00
Jon Siwek
3a824a06ed Fix is/as operators on vector values 2018-09-10 14:54:54 -05:00
Jon Siwek
a467d0c92d Add @deprecated directive
It emits a warning stating that the script is deprecated.
2018-08-31 09:24:03 -05:00
Jon Siwek
611c00a605 Merge remote-tracking branch 'origin/topic/johanna/bit-1976'
* origin/topic/johanna/bit-1976:
  Allow event/function definitions to be wrapped in directives.

Fixed to work with attributes (e.g. &priority).
2018-08-29 18:28:54 -05:00
Johanna Amann
fb95a7750e Allow event/function definitions to be wrapped in directives.
This makes

@if (conditions)
event a(...)
@else
event b(...)
@endif

work, which threw an error in the past. This is useful when event
definition change in newer Bro version and code wants to accept both
kinds of events.
2018-08-28 16:00:34 -07:00
Jon Siwek
bd24421734 BIT-466: add redef += support to vectors 2018-08-17 15:16:15 -05:00
Jon Siwek
f336c8c710 Fix seg fault on trying to type-cast invalid/nil Broker::Data
This situation now throws a runtime expression exception instead of
crashing on null pointer access.
2018-08-15 11:02:52 -05:00
Jon Siwek
599af26496 Merge remote-tracking branch 'origin/topic/vern/vec-append'
* origin/topic/vern/vec-append:
  d'oh, still have a (deprecated) string_array rather than string_vector
  forgot to update test suite results for v += e
  reap the fruits of v += e
  test case for v += e
  documentation of v += e
  v += e implemented

Fixed a mistake in find_ip_addresses()
2018-08-03 11:38:40 -05:00
Jon Siwek
06c6e1188a Merge remote-tracking branch 'origin/topic/vern/set-ops2'
* origin/topic/vern/set-ops2:
  documentation, test suite update
  implemented set relationals
  bug fix for set intersection
  set intersection implemented
  mirroring previous topic/vern/set-ops to get branch up to date, since I'm a n00b

Fixed a couple memory leaks and added a leak test
2018-08-02 10:43:41 -05:00
Vern Paxson
88fd7510c6 reap the fruits of v += e 2018-07-26 12:51:36 -07:00
Vern Paxson
81c63a0c65 test case for v += e 2018-07-26 12:37:06 -07:00
Vern Paxson
86cd484759 documentation, test suite update 2018-07-20 08:57:37 -07:00
Vern Paxson
85c4b0d285 use PCRE syntax instead of the beautiful new (?i ...) syntax 2018-06-29 13:01:05 -07:00
Vern Paxson
f5e89b96ae test suite update for case-insensitive patterns 2018-06-29 11:55:50 -07:00
Vern Paxson
762048cb41 test suite updates for &/| pattern operators 2018-06-22 15:29:10 -07:00
Jon Siwek
e5275b0c92 Merge branch 'topic/vern/bit-ops' of https://github.com/bro/bro
* 'topic/vern/bit-ops' of https://github.com/bro/bro:
  documentation clarification for "p1 | p2"
  documentation for bitwise operators
  document the '|' operator for patterns
  test suite for bitwise operators brief NEWS blurb allow for "counter" operands (does anyone still use these?) for one (but not both) of the bitwise operands
  bitwise operations for "count" types implemented
  Starting branch for supporting bit operations on count's.
2018-06-21 16:05:07 -05:00
Robin Sommer
fe7e1ee7f0 Merge topic/actor-system throug a squashed commit. 2018-05-18 22:39:23 +00:00
Vern Paxson
58ffd61dcc test suite for bitwise operators
brief NEWS blurb
allow for "counter" operands (does anyone still use these?) for one (but not both) of the bitwise operands
2018-04-26 13:25:04 -07:00
Jon Siwek
8152508330 BIT-1909: fix invalid redef'd record field accesses 2018-04-11 16:23:26 -05:00
Daniel Thayer
7127800791 Fix the expire-redef.bro test
The expire-redef.bro test was sometimes failing due to the second "Run"
message being printed after (should happen before) the "Expired"
message.  Fixed by increasing the time interval between events.

Also reduced the number of events raised to make the test finish more
quickly.
2017-08-10 14:15:31 -05:00
Daniel Thayer
bd2d559fbf Fix race condition causing some tests to fail
Removed loading of the "frameworks/communication/listen" script for
a couple of tests that don't need this functionality.  This was causing
failures of some broccoli-related tests in the "istate" test directory
due to two instances of Bro trying to listen on the same port.
2017-05-24 14:45:11 -05:00
Jon Siwek
c857f5c4dd BIT-1785: fix scripts able to access uninitialized variables. 2017-02-06 23:30:54 -06:00
Johanna Amann
8eddeed78f Allow access to global variables using GLOBAL:: namespace.
Addresses BIT-1758. Patch was contributed by François Pennaneach
<francois.pennaneach@free.fr>.
2016-12-07 15:28:34 -08:00
Robin Sommer
83ff3f8cdc Attempt to make test more stable. 2016-08-12 08:19:51 -07:00
Robin Sommer
9da02ecae4 Merge branch 'topic/jgras/expire-redef' of https://github.com/J-Gras/bro
Extended error handling a bit, and increased serialization
data format version.
2016-06-14 17:22:25 -07:00
Johanna Amann
a72112acca Fix precedence of hook
The precedence is now lower than the precedence of &&/|| so that
expressions like

hook a() && doSomething()

work.

Addresses BIT-1619
2016-06-13 16:02:06 -07:00
Jan Grashoefer
8a87055fcc Fixed table expiration evaluation.
The expiration attribute expression is now evaluated for every use. Thus
later adjustments of the value (e.g. by redefining a const) will now
take effect. Values less than 0 will disable expiration.
2016-06-13 21:01:46 +02:00
Robin Sommer
53c523fa6f Normalizing test baseline. 2016-05-24 22:16:31 -07:00
Robin Sommer
4f9cb6912a Fix for a table refering to a expire function that's not defined.
I was hoping to report this right at startup through a static check
but turns out we don't have the right machinery in place for that.
That would need to be done after the AST has been finalized, but our
AST traversal code can't iterate over types. So instead I've changed
this so that it's still being reported at runtime but at least
doesn't crash Bro anymore.

Closes BIT-1597.
2016-05-23 12:48:34 -07:00
Johanna Amann
8f6cdbb489 Fix test failing when we use &> instead of 2>
On the shell of a few systems, that apparently masks the return code.

(Namely - Debian and FreeBSD)
2016-05-13 07:44:30 -07:00
Johanna Amann
5f50733276 Merge branch 'topic/jgras/event-vars' of https://github.com/J-Gras/bro 2016-05-12 07:40:44 -07:00
Jan Grashoefer
65607239c9 Added interpreter error for local event variables.
Scheduling a local event variable resulted in a global lookup instead of
evaluating the local variable. To prevent misunderstandings, this will
trigger an error now.
2016-05-11 12:26:11 +02:00
Robin Sommer
a9cb90b6f5 Adding canonifier to test. 2016-03-21 21:08:42 -07:00
Johanna Amann
cfffb6e634 Check that there is only one of read, write, create_expire 2016-03-18 12:34:26 -07:00
Jan Grashoefer
a5f4e8aafe Added &read_expire testcase for subnet tables 2016-03-17 19:53:22 +01:00
Johanna Amann
c5a14d1bc1 Fix crash when printing type of recursive structures.
Also slightly fix indentation in Type.h
2016-02-03 13:22:05 -08:00
Johanna Amann
13c4489578 Testcase for crash when a record contains a function referencing a record.
Needs BRO_PROFILER_FILE set to crash
2016-01-21 13:56:21 -08:00
Johanna Amann
990726b514 Fix crash when deleting non existing record member.
Addresses BIT-1519
2016-01-12 15:02:20 -08:00
Jon Siwek
48fccb3bce BIT-1350: improve record coercion type checking.
For a field of the same name in both the target type and the coerced
type, a type mismatch is now reported as an error at parse-time.
2015-04-27 16:37:40 -05:00
Jon Siwek
57501c6069 BIT-1367: improve coercion of anonymous records in set constructor.
Error messages for set constructors that fail the type check may also be
more verbose than before and point out specifically the suspect types.
2015-04-06 12:14:59 -05:00
Jon Siwek
062baefde0 Add 'while' statement to Bro language. 2015-02-13 11:26:54 -06:00
Jon Siwek
011e2cdd32 Improve use of &deprecated on functions.
- Don't report warnings on function definition if declaration is marked
  deprecated.
- Allow &deprecated to apply to a standalone function definition.
2015-01-21 12:27:09 -06:00
Jon Siwek
87962a48dd Add a new attribute: &deprecated.
While scripts are parsed, a warning is raised for each usage of an
identifier marked as &deprecated.  This also works for BIFs.

Addresses BIT-924, BIT-757.
2015-01-21 09:40:50 -06:00
Jon Siwek
cdbe459f20 Make using local IDs in @if directives an error.
Addresses BIT-1296.
2014-12-02 12:30:46 -06:00
Jon Siwek
f214158cc5 BIT-1288: Improve coercion of &default expressions. 2014-11-18 12:40:16 -06:00
Robin Sommer
78de5c17ef Merge remote-tracking branch 'origin/topic/jsiwek/bit-1176'
* origin/topic/jsiwek/bit-1176:
  Fix segfault if when statement's RHS is unitialized.

BIT-1176 #merged
2014-10-31 16:30:49 -07:00
Robin Sommer
2e7b732c4b Merge remote-tracking branch 'origin/topic/jsiwek/bit-1280'
* origin/topic/jsiwek/bit-1280:
  BIT-1280: Fix checking vector indices via "in".

BIT-1280 #merged.
2014-10-31 16:28:08 -07:00
Jon Siwek
2a181a88c5 Allow arbitrary when statement timeout expressions
BIT-1284 #close
2014-10-31 10:38:23 -05:00
Jon Siwek
1f7facda5b Fix segfault if when statement's RHS is unitialized.
If it is ever assigned a value, the body of the when can be triggered as
usual.

Addresses BIT-1176.
2014-10-30 12:19:25 -05:00
Jon Siwek
e5f75cde93 BIT-1280: Fix checking vector indices via "in".
$ cat test.bro
local vec: vector of string = { "zero" };
vec[2] = "two";
print 0 in vec, 1 in vec, 2 in vec;

$ bro -b test.bro
T, F, T
2014-10-28 14:21:16 -05:00