mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix sporadic openflow/broker test failure
Looked like a possible race condition in how the test was structured: an endpoint sees its peer got lost and likewise exits immediately before having a chance to process events the peer had sent just before exiting. Fix is to reverse which endpoint initiates the termination sequence so we can be sure we see the required events.
This commit is contained in:
parent
c640dd70cc
commit
eda7610806
3 changed files with 17 additions and 20 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
|||
|
||||
2.6-264 | 2019-05-03 11:16:38 -0700
|
||||
|
||||
* Fix sporadic openflow/broker test failure (Jon Siwek, Corelight)
|
||||
|
||||
2.6-263 | 2019-05-02 22:49:40 -0700
|
||||
|
||||
* Install local.zeek as symlink to pre-existing local.bro (Jon Siwek, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.6-263
|
||||
2.6-264
|
||||
|
|
|
@ -55,14 +55,26 @@ event connection_established(c: connection)
|
|||
OpenFlow::flow_mod(of_controller, match_rev, flow_mod);
|
||||
}
|
||||
|
||||
global msg_count: count = 0;
|
||||
|
||||
function got_message()
|
||||
{
|
||||
++msg_count;
|
||||
|
||||
if ( msg_count == 6 )
|
||||
terminate();
|
||||
}
|
||||
|
||||
event OpenFlow::flow_mod_success(name: string, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod, msg: string)
|
||||
{
|
||||
print "Flow_mod_success";
|
||||
got_message();
|
||||
}
|
||||
|
||||
event OpenFlow::flow_mod_failure(name: string, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod, msg: string)
|
||||
{
|
||||
print "Flow_mod_failure";
|
||||
got_message();
|
||||
}
|
||||
|
||||
@TEST-END-FILE
|
||||
|
@ -73,13 +85,6 @@ event OpenFlow::flow_mod_failure(name: string, match: OpenFlow::ofp_match, flow_
|
|||
|
||||
redef exit_only_after_terminate = T;
|
||||
|
||||
global msg_count: count = 0;
|
||||
|
||||
event die()
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
Broker::subscribe("bro/openflow");
|
||||
|
@ -96,28 +101,16 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
|||
terminate();
|
||||
}
|
||||
|
||||
function got_message()
|
||||
{
|
||||
++msg_count;
|
||||
|
||||
if ( msg_count >= 4 )
|
||||
{
|
||||
schedule 2sec { die() };
|
||||
}
|
||||
}
|
||||
|
||||
event OpenFlow::broker_flow_mod(name: string, dpid: count, match: OpenFlow::ofp_match, flow_mod: OpenFlow::ofp_flow_mod)
|
||||
{
|
||||
print "got flow_mod", dpid, match, flow_mod;
|
||||
Broker::publish("bro/openflow", OpenFlow::flow_mod_success, name, match, flow_mod, "");
|
||||
Broker::publish("bro/openflow", OpenFlow::flow_mod_failure, name, match, flow_mod, "");
|
||||
got_message();
|
||||
}
|
||||
|
||||
event OpenFlow::broker_flow_clear(name: string, dpid: count)
|
||||
{
|
||||
print "flow_clear", dpid;
|
||||
got_message();
|
||||
}
|
||||
|
||||
@TEST-END-FILE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue