From e2dee49fc1daf9bd49a7ed2c02f74166de85192a Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Tue, 17 May 2016 16:05:50 -0700 Subject: [PATCH] Fixing control frameworks net_stats and peer_status commands. Turns out the code implementing them went missing with the recent merge of the stats changes. For peer status, I removed most of the numbers that the code used to return because (1) we don't have access to that data anymore, and (2) even in 2.4 the numbers returned already didn't make sense (because they were global values, not per peer). We could consider just removing the peer_status command at all. --- aux/broctl | 2 +- scripts/policy/frameworks/control/controllee.bro | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/aux/broctl b/aux/broctl index 6f12b4da74..2d6caeacea 160000 --- a/aux/broctl +++ b/aux/broctl @@ -1 +1 @@ -Subproject commit 6f12b4da74e9e0885e1bd8cb67c2eda2b33c93a5 +Subproject commit 2d6caeacead070a6e12524bedebaf95f9f444bc6 diff --git a/scripts/policy/frameworks/control/controllee.bro b/scripts/policy/frameworks/control/controllee.bro index 7001721f69..9646d100ab 100644 --- a/scripts/policy/frameworks/control/controllee.bro +++ b/scripts/policy/frameworks/control/controllee.bro @@ -22,10 +22,26 @@ event Control::id_value_request(id: string) event Control::peer_status_request() { + local status = ""; + for ( p in Communication::nodes ) + { + local peer = Communication::nodes[p]; + if ( ! peer$connected ) + next; + + status += fmt("%.6f peer=%s host=%s\n", + network_time(), peer$peer$descr, peer$host); + } + + event Control::peer_status_response(status); } event Control::net_stats_request() { + local ns = get_net_stats(); + local reply = fmt("%.6f recvd=%d dropped=%d link=%d\n", network_time(), + ns$pkts_recvd, ns$pkts_dropped, ns$pkts_link); + event Control::net_stats_response(reply); } event Control::configuration_update_request()