[Bro-Dev] #86: Bro-Bro event communication tricky to test

Bro Tracker bro at tracker.icir.org
Sat Dec 11 21:22:32 PST 2010


#86: Bro-Bro event communication tricky to test
-----------------------+-------------------------------------------------
  Reporter:  kreibich  |      Owner:  robin
      Type:  Problem   |     Status:  assigned
  Priority:  Low       |  Milestone:  Bro1.6
 Component:  Bro       |    Version:  1.5.2
Resolution:            |   Keywords:  communication, bro, schedule, event
-----------------------+-------------------------------------------------
Changes (by seth):

 * owner:  kreibich => robin
 * status:  seen => assigned
 * milestone:   => Bro1.6


Comment:

 This looks like a fairly small bug in the RemoteSerializer code.  I think
 the following patch should fix the problem (in addition to cleaning up the
 use of the current_peer variable in a few spots).

 It looks like the if-statement I removed in the first chunk of the patch
 is where the problem was and the erased comment does not seem to be true
 after testing.  Events will not be sent back to the event originator even
 without that line due to the code path taken by remotely received events.
 I pasted the patch here though because it really needs checked out by
 Robin before going anywhere.

 {{{
 diff --git a/src/RemoteSerializer.cc b/src/RemoteSerializer.cc
 index a9329cc..51add7c 100644
 --- a/src/RemoteSerializer.cc
 +++ b/src/RemoteSerializer.cc
 @@ -823,14 +823,9 @@ bool RemoteSerializer::SendCall(SerialInfo* info,
 PeerID id,
         if ( ! peer )
                 return false;

 -       // Do not send events back to originating peer.
 -       if ( current_peer == peer )
 -               return true;
 -
         return SendCall(info, peer, name, vl);
         }

 -
  bool RemoteSerializer::SendCall(SerialInfo* info, Peer* peer,
                                         const char* name, val_list* vl)
         {
 @@ -1841,10 +1836,9 @@ bool RemoteSerializer::EnterPhaseRunning(Peer*
 peer)
         if ( in_sync == peer )
                 in_sync = 0;

 -       current_peer->phase = Peer::RUNNING;
 +       peer->phase = Peer::RUNNING;
         Log(LogInfo, "phase: running", peer);
 -
 -       RaiseEvent(remote_connection_handshake_done, current_peer);
 +       RaiseEvent(remote_connection_handshake_done, peer);

         if ( remote_trace_sync_interval )
                 {
 @@ -2008,12 +2002,11 @@ bool RemoteSerializer::HandshakeDone(Peer* peer)
                         return false;
  #endif

 -       if ( ! (current_peer->caps & Peer::PID_64BIT) )
 -               Log(LogInfo, "peer does not support 64bit PIDs; using
 compatibility mode", current_peer);
 +       if ( ! (peer->caps & Peer::PID_64BIT) )
 +               Log(LogInfo, "peer does not support 64bit PIDs; using
 compatibility mode", peer);

 -       if ( (current_peer->caps & Peer::NEW_CACHE_STRATEGY) )
 -               Log(LogInfo, "peer supports keep-in-cache; using that",
 -                       current_peer);
 +       if ( (peer->caps & Peer::NEW_CACHE_STRATEGY) )
 +               Log(LogInfo, "peer supports keep-in-cache; using that",
 peer);

         if ( peer->sync_requested != Peer::NONE )
                 {
 @@ -2030,7 +2023,7 @@ bool RemoteSerializer::HandshakeDone(Peer* peer)
                         {
                         Log(LogError, "misconfiguration: authoritative
 state on both sides",
                                 current_peer);
 -                       CloseConnection(current_peer);
 +                       CloseConnection(peer);
                         return false;
                         }


 }}}

-- 
Ticket URL: <http://tracker.icir.org/bro/ticket/86#comment:2>
Bro Tracker <http://tracker.icir.org/bro>
Bro Issue Tracker



More information about the bro-dev mailing list