Plugins: Change order in which plugins' scripts are loaded at startup.

We now load the top-level  __init__.bro before the internal bif.bro so
that the former can define types used by the latter.
This commit is contained in:
Robin Sommer 2014-10-23 14:20:59 -07:00
parent 2002fd7f90
commit 3e508d316a
7 changed files with 15 additions and 12 deletions

View file

@ -1,4 +1,9 @@
2.3-248 | 2014-10-23 14:20:59 -0700
* Change order in which a plugin's scripts are loaded at startup.
(Robin Sommer)
2.3-247 | 2014-10-21 13:42:38 -0700 2.3-247 | 2014-10-21 13:42:38 -0700
* Updates to the SSL analyzer. (Johanna Amann) * Updates to the SSL analyzer. (Johanna Amann)

View file

@ -1 +1 @@
2.3-247 2.3-248

View file

@ -172,7 +172,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
// Load {bif,scripts}/__load__.bro automatically. // Load {bif,scripts}/__load__.bro automatically.
string init = dir + "lib/bif/__load__.bro"; string init = dir + "scripts/__load__.bro";
if ( is_file(init) ) if ( is_file(init) )
{ {
@ -180,7 +180,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
scripts_to_load.push_back(init); scripts_to_load.push_back(init);
} }
init = dir + "scripts/__load__.bro"; init = dir + "lib/bif/__load__.bro";
if ( is_file(init) ) if ( is_file(init) )
{ {

View file

@ -3,5 +3,5 @@ Demo::Foo - <Insert description> (dynamic, version 1.0)
[Event] plugin_event [Event] plugin_event
plugin: automatically loaded at startup plugin: automatically loaded at startup
calling bif, Hello from the plugin!
plugin: manually loaded plugin: manually loaded
calling bif, Hello from the plugin!

View file

@ -4,21 +4,19 @@ Demo::Foo - <Insert description> (dynamic, version 1.0)
=== ===
plugin: automatically loaded at startup plugin: automatically loaded at startup
calling bif, Hello from the plugin!
=== ===
plugin: automatically loaded at startup plugin: automatically loaded at startup
calling bif, Hello from the plugin!
plugin: manually loaded plugin: manually loaded
calling bif, Hello from the plugin!
=-= =-=
=-= =-=
=== ===
plugin: automatically loaded at startup plugin: automatically loaded at startup
===
plugin: automatically loaded at startup
plugin: manually loaded
calling bif, Hello from the plugin! calling bif, Hello from the plugin!
=== ===
plugin: automatically loaded at startup plugin: automatically loaded at startup
calling bif, Hello from the plugin!
plugin: manually loaded plugin: manually loaded
===
plugin: automatically loaded at startup
calling bif, Hello from the plugin! calling bif, Hello from the plugin!
plugin: manually loaded

View file

@ -21,6 +21,7 @@ cat >scripts/demo/foo/manually.bro <<EOF
event bro_init() &priority=-10 event bro_init() &priority=-10
{ {
print "plugin: manually loaded"; print "plugin: manually loaded";
print "calling bif", hello_plugin_world();
} }
EOF EOF
@ -28,7 +29,6 @@ cat >scripts/demo/foo/base/at-startup.bro <<EOF
event bro_init() &priority=10 event bro_init() &priority=10
{ {
print "plugin: automatically loaded at startup"; print "plugin: automatically loaded at startup";
print "calling bif", hello_plugin_world();
} }
EOF EOF

View file

@ -37,6 +37,7 @@ cat >scripts/demo/foo/manually.bro <<EOF
event bro_init() &priority=-10 event bro_init() &priority=-10
{ {
print "plugin: manually loaded"; print "plugin: manually loaded";
print "calling bif", hello_plugin_world();
} }
EOF EOF
@ -44,7 +45,6 @@ cat >scripts/demo/foo/base/at-startup.bro <<EOF
event bro_init() &priority=10 event bro_init() &priority=10
{ {
print "plugin: automatically loaded at startup"; print "plugin: automatically loaded at startup";
print "calling bif", hello_plugin_world();
} }
EOF EOF