mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-19 02:11:28 +00:00
* opensync_stats.proto gets compiled during the build process. The pre-compiled files (opensync_stats.pb-c.*) should not be patched any longer; I have also updated some older patches for all of this this to work. OpenWrt creates a temporary proto-c package for the host ARCH and generates source and header files for the target platform. This happens after all the patches have been applied and just before the opensync compilation process. Signed-off-by: Damir Franusic <damir.franusic@netexperience.com>
365 lines
14 KiB
Diff
365 lines
14 KiB
Diff
Index: opensync-2.0.5.0/src/lib/datapipeline/inc/dpp_network_probe.h
|
|
===================================================================
|
|
--- opensync-2.0.5.0.orig/src/lib/datapipeline/inc/dpp_network_probe.h
|
|
+++ opensync-2.0.5.0/src/lib/datapipeline/inc/dpp_network_probe.h
|
|
@@ -5,7 +5,7 @@
|
|
#include "ds_dlist.h"
|
|
|
|
#include "dpp_types.h"
|
|
-
|
|
+#define DPP_RADIUS_SERVERS_MAX 24
|
|
#define MAX_IP_ADDR_SIZE 16
|
|
#define MAX_IF_NAME_SIZE 16
|
|
typedef enum
|
|
@@ -29,17 +29,6 @@ typedef struct
|
|
char vlanIF[MAX_IF_NAME_SIZE];
|
|
StateUpDown_t dhcpState;
|
|
uint32_t dhcpLatency;
|
|
- StateUpDown_t dnsState;
|
|
- uint32_t dnsLatency;
|
|
- StateUpDown_t obsV200_radiusState;
|
|
- uint32_t obsV200_radiusLatency;
|
|
- dpp_dns_metrics_t dnsProbeResults;
|
|
- uint32_t dur_vlanIF;
|
|
- uint32_t dur_dhcpState;
|
|
- uint32_t dur_dhcpLatency;
|
|
- uint32_t dur_dnsState;
|
|
- uint32_t dur_dnsLatency;
|
|
- uint32_t dur_dnsReport;
|
|
} dpp_vlan_metrics_t;
|
|
|
|
|
|
@@ -47,29 +36,42 @@ typedef struct
|
|
typedef struct
|
|
{
|
|
char serverIP[MAX_IP_ADDR_SIZE];
|
|
- uint32_t noAnswer;
|
|
- uint32_t latencyMin;
|
|
- uint32_t latencyMax;
|
|
- uint32_t latencyAve;
|
|
-
|
|
- // -- duration
|
|
- uint32_t dur_serverIP; //category Network
|
|
- uint32_t dur_noAnswer; //category Network
|
|
- uint32_t dur_latencyMin; //category Network
|
|
- uint32_t dur_latencyMax; //category Network
|
|
- uint32_t dur_latencyAve; //category Network
|
|
+ StateUpDown_t radiusState;
|
|
+ uint32_t latency;
|
|
+ ds_dlist_node_t node;
|
|
} dpp_radius_metrics_t;
|
|
|
|
+static inline dpp_radius_metrics_t * dpp_radius_metrics_record_alloc()
|
|
+{
|
|
+ dpp_radius_metrics_t *record = NULL;
|
|
+
|
|
+ record = malloc(sizeof(dpp_radius_metrics_t));
|
|
+ if (record)
|
|
+ {
|
|
+ memset(record, 0, sizeof(dpp_radius_metrics_t));
|
|
+ }
|
|
+
|
|
+ return record;
|
|
+}
|
|
+
|
|
+static inline void dpp_radius_metrics_record_free(dpp_radius_metrics_t *record)
|
|
+{
|
|
+ if (NULL != record)
|
|
+ {
|
|
+ free(record);
|
|
+ }
|
|
+}
|
|
+
|
|
typedef struct
|
|
{
|
|
dpp_dns_metrics_t dns_probe;
|
|
dpp_vlan_metrics_t vlan_probe;
|
|
- dpp_radius_metrics_t radius_probe;
|
|
} dpp_network_probe_record_t;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
+ ds_dlist_t radius_probe;
|
|
dpp_network_probe_record_t record;
|
|
uint64_t timestamp_ms;
|
|
} dpp_network_probe_report_data_t;
|
|
Index: opensync-2.0.5.0/src/lib/target/inc/target_common.h
|
|
===================================================================
|
|
--- opensync-2.0.5.0.orig/src/lib/target/inc/target_common.h
|
|
+++ opensync-2.0.5.0/src/lib/target/inc/target_common.h
|
|
@@ -564,6 +564,7 @@ bool target_stats_scan_get(
|
|
* NETWORK PROBE definitions
|
|
*****************************************************************************/
|
|
bool target_stats_network_probe_get(dpp_network_probe_record_t *network_probe_report);
|
|
+bool target_stats_radius_probe_get(struct schema_Wifi_VIF_State schema, dpp_radius_metrics_t *radius_probe_report);
|
|
|
|
/******************************************************************************
|
|
* DEVICE definitions
|
|
Index: opensync-2.0.5.0/src/sm/src/sm_network_probe_report.c
|
|
===================================================================
|
|
--- opensync-2.0.5.0.orig/src/sm/src/sm_network_probe_report.c
|
|
+++ opensync-2.0.5.0/src/sm/src/sm_network_probe_report.c
|
|
@@ -82,6 +82,24 @@ bool dpp_network_probe_report_timer_set(
|
|
return true;
|
|
}
|
|
|
|
+static
|
|
+bool sm_radius_list_clear (
|
|
+ ds_dlist_t *radius_list)
|
|
+{
|
|
+ dpp_radius_metrics_t *record = NULL;
|
|
+ ds_dlist_iter_t record_iter;
|
|
+
|
|
+ for ( record = ds_dlist_ifirst(&record_iter, radius_list);
|
|
+ record != NULL;
|
|
+ record = ds_dlist_inext(&record_iter))
|
|
+ {
|
|
+ ds_dlist_iremove(&record_iter);
|
|
+ dpp_radius_metrics_record_free(record);
|
|
+ record = NULL;
|
|
+ }
|
|
+
|
|
+ return true;
|
|
+}
|
|
|
|
static
|
|
bool dpp_network_probe_report_timer_restart(
|
|
@@ -128,6 +146,32 @@ void sm_network_probe_report (EV_P_ ev_t
|
|
|
|
dpp_network_probe_report_timer_restart(report_timer);
|
|
|
|
+ ds_tree_t *vifs = sm_vifs_get();
|
|
+ sm_vif_state_t *vif;
|
|
+ dpp_radius_metrics_t *temp;
|
|
+
|
|
+ ds_tree_foreach(vifs, vif)
|
|
+ {
|
|
+ temp = NULL;
|
|
+ temp =
|
|
+ dpp_radius_metrics_record_alloc();
|
|
+ if (NULL == temp) {
|
|
+ goto clean;
|
|
+ }
|
|
+
|
|
+ rc =
|
|
+ target_stats_radius_probe_get (
|
|
+ vif->schema,
|
|
+ temp);
|
|
+ if (true != rc) {
|
|
+ dpp_radius_metrics_record_free(temp);
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ /* Add radius config to report */
|
|
+ ds_dlist_insert_tail(&report_ctx->radius_probe, temp);
|
|
+ }
|
|
+
|
|
/* Get network probe stats */
|
|
rc =
|
|
target_stats_network_probe_get (
|
|
@@ -149,6 +193,10 @@ void sm_network_probe_report (EV_P_ ev_t
|
|
sm_timestamp_ms_to_date(report_ctx->timestamp_ms), report_ctx->record.dns_probe.latency);
|
|
|
|
dpp_put_network_probe(report_ctx);
|
|
+
|
|
+clean:
|
|
+ /* Clear radius list */
|
|
+ sm_radius_list_clear(&report_ctx->radius_probe);
|
|
}
|
|
|
|
|
|
@@ -183,6 +231,10 @@ bool sm_network_probe_report_request(
|
|
LOG(INFO,
|
|
"Initializing network probe reporting");
|
|
|
|
+ ds_dlist_init(
|
|
+ &report_ctx->radius_probe,
|
|
+ dpp_radius_metrics_t,
|
|
+ node);
|
|
/* Initialize event lib timers and pass the global
|
|
internal cache
|
|
*/
|
|
@@ -211,6 +263,7 @@ bool sm_network_probe_report_request(
|
|
}
|
|
else {
|
|
LOG(INFO, "Stopped network probe reporting");
|
|
+ sm_radius_list_clear(&report_ctx->radius_probe);
|
|
memset(request_ctx, 0, sizeof(*request_ctx));
|
|
}
|
|
|
|
Index: opensync-2.0.5.0/src/sm/src/sm.h
|
|
===================================================================
|
|
--- opensync-2.0.5.0.orig/src/sm/src/sm.h
|
|
+++ opensync-2.0.5.0/src/sm/src/sm.h
|
|
@@ -303,6 +303,7 @@ typedef struct
|
|
} sm_stats_config_t;
|
|
|
|
ds_tree_t *sm_radios_get();
|
|
+ds_tree_t *sm_vifs_get();
|
|
|
|
|
|
void sm_vif_whitelist_get(char **mac_list, uint16_t *mac_size, uint16_t *mac_qty);
|
|
Index: opensync-2.0.5.0/interfaces/opensync_stats.proto
|
|
===================================================================
|
|
--- opensync-2.0.5.0.orig/interfaces/opensync_stats.proto
|
|
+++ opensync-2.0.5.0/interfaces/opensync_stats.proto
|
|
@@ -511,13 +511,13 @@ message RssiReport {
|
|
//
|
|
// Network probe parameters
|
|
//
|
|
-////////////////////////////////////////////////////////////////////////////////
|
|
+///////////////////////////////////////////////////////////////////////////////
|
|
enum StateUpDown {
|
|
SUD_down = 0;
|
|
SUD_up = 1;
|
|
SUD_error = 2;
|
|
}
|
|
-
|
|
+
|
|
message DNSProbeMetric {
|
|
optional string serverIP = 1;
|
|
optional StateUpDown state = 2; // State of the server
|
|
@@ -527,44 +527,20 @@ message DNSProbeMetric {
|
|
message VLANMetrics {
|
|
optional string vlanIF = 1; // The name of the interface (ie: brtrunk.100)
|
|
optional StateUpDown dhcpState = 2; // The state of the DHCP server according to that vlan
|
|
- optional uint32 dhcpLatency = 3;
|
|
- optional StateUpDown dnsState = 4; // The state of the DNS server according to that vlan
|
|
- optional uint32 dnsLatency = 5;
|
|
- optional StateUpDown obsV200_radiusState = 6; // The state of the Radius server according to that vlan
|
|
- optional uint32 obsV200_radiusLatency = 7;
|
|
- repeated DNSProbeMetric dnsProbeResults = 8; // ver=1300
|
|
-
|
|
- // -- duration
|
|
- optional uint32 dur_vlanIF = 501; //category Network
|
|
- optional uint32 dur_dhcpState = 502; //category Network
|
|
- optional uint32 dur_dhcpLatency = 503; //category Network
|
|
- optional uint32 dur_dnsState = 504; //category Network
|
|
- optional uint32 dur_dnsLatency = 505; //category Network
|
|
- // optional uint32 obsV200_dur_radiusState = 506;
|
|
- // optional uint32 obsV200_dur_radiusLatency = 507;
|
|
- optional uint32 dur_dnsReport = 508;
|
|
+ optional uint32 latency = 3;
|
|
}
|
|
|
|
message RADIUSMetrics {
|
|
- optional bytes serverIP = 1;
|
|
- optional uint32 noAnswer = 2;
|
|
- optional uint32 latencyMin = 3;
|
|
- optional uint32 latencyMax = 4;
|
|
- optional uint32 latencyAve = 5;
|
|
-
|
|
- // -- duration
|
|
- optional uint32 dur_serverIP = 501; //category Network
|
|
- optional uint32 dur_noAnswer = 502; //category Network
|
|
- optional uint32 dur_latencyMin = 503; //category Network
|
|
- optional uint32 dur_latencyMax = 504; //category Network
|
|
- optional uint32 dur_latencyAve = 505; //category Network
|
|
+ optional string serverIP = 1;
|
|
+ optional StateUpDown radiusState = 2;
|
|
+ optional uint32 latency = 3;
|
|
}
|
|
|
|
|
|
message NetworkProbe {
|
|
optional DNSProbeMetric dns_probe = 1;
|
|
optional VLANMetrics vlan_probe = 2;
|
|
- optional RADIUSMetrics radius_probe = 3;
|
|
+ repeated RADIUSMetrics radius_probe = 3;
|
|
optional uint64 timestamp_ms = 4;
|
|
}
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
Index: opensync-2.0.5.0/src/lib/datapipeline/src/dppline.c
|
|
===================================================================
|
|
--- opensync-2.0.5.0.orig/src/lib/datapipeline/src/dppline.c
|
|
+++ opensync-2.0.5.0/src/lib/datapipeline/src/dppline.c
|
|
@@ -93,6 +93,7 @@ typedef struct
|
|
|
|
typedef struct dpp_network_probe_stats
|
|
{
|
|
+ dpp_radius_metrics_t *list;
|
|
dpp_network_probe_record_t record;
|
|
uint32_t qty;
|
|
uint64_t timestamp_ms;
|
|
@@ -231,6 +232,7 @@ static void dppline_free_stat(dppline_st
|
|
free(s->u.rssi.list);
|
|
break;
|
|
case DPP_T_NETWORK_PROBE:
|
|
+ free(s->u.network_probe.list);
|
|
break;
|
|
default:;
|
|
}
|
|
@@ -646,9 +648,38 @@ static bool dppline_copysts(dppline_stat
|
|
case DPP_T_NETWORK_PROBE:
|
|
{
|
|
dpp_network_probe_report_data_t *report_data = sts;
|
|
+ dpp_radius_metrics_t *result_entry = NULL;
|
|
+ ds_dlist_iter_t result_iter;
|
|
+
|
|
+
|
|
memcpy(&dst->u.network_probe.record.dns_probe, &report_data->record.dns_probe, sizeof(dpp_dns_metrics_t));
|
|
memcpy(&dst->u.network_probe.record.vlan_probe, &report_data->record.vlan_probe, sizeof(dpp_vlan_metrics_t));
|
|
dst->u.network_probe.timestamp_ms = report_data->timestamp_ms;
|
|
+
|
|
+ /* Loop through linked list of results and copy them to dppline buffer */
|
|
+
|
|
+ dst->u.network_probe.qty = 0;
|
|
+ for ( result_entry = ds_dlist_ifirst(&result_iter, &report_data->radius_probe);
|
|
+ result_entry != NULL;
|
|
+ result_entry = ds_dlist_inext(&result_iter))
|
|
+ {
|
|
+ size = (dst->u.network_probe.qty + 1) * sizeof(dpp_radius_metrics_t);
|
|
+ if (!dst->u.network_probe.qty)
|
|
+ {
|
|
+ dst->u.network_probe.list = calloc(1, size);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ dst->u.network_probe.list = realloc(dst->u.network_probe.list, size);
|
|
+ memset(&dst->u.network_probe.list[dst->u.network_probe.qty],
|
|
+ 0,
|
|
+ sizeof(dpp_radius_metrics_t));
|
|
+ }
|
|
+ memcpy(&dst->u.network_probe.list[dst->u.network_probe.qty++],
|
|
+ result_entry,
|
|
+ sizeof(dpp_radius_metrics_t));
|
|
+ }
|
|
+
|
|
}
|
|
break;
|
|
default:
|
|
@@ -1628,9 +1659,30 @@ static void dppline_add_stat_network_pro
|
|
size += strlen(network_probe->record.vlan_probe.vlanIF) + 1;
|
|
sr->vlan_probe->dhcpstate = network_probe->record.vlan_probe.dhcpState;
|
|
sr->vlan_probe->has_dhcpstate = true;
|
|
- sr->vlan_probe->dhcplatency = network_probe->record.vlan_probe.dhcpLatency;
|
|
- sr->vlan_probe->has_dhcplatency = true;
|
|
+ sr->vlan_probe->latency = network_probe->record.vlan_probe.dhcpLatency;
|
|
+ sr->vlan_probe->has_latency = true;
|
|
|
|
+ if (network_probe->qty > 0)
|
|
+ {
|
|
+ sr->radius_probe = malloc(network_probe->qty * sizeof(*sr->radius_probe));
|
|
+ size += network_probe->qty * sizeof(*sr->radius_probe);
|
|
+ assert(sr->radius_probe);
|
|
+ }
|
|
+ sr->n_radius_probe = network_probe->qty;
|
|
+ for (uint i = 0; i < network_probe->qty; i++)
|
|
+ {
|
|
+ sr->radius_probe[i] = malloc(sizeof(**sr->radius_probe));
|
|
+ size += sizeof(**sr->radius_probe);
|
|
+ assert(sr->radius_probe[i]);
|
|
+ sts__radiusmetrics__init(sr->radius_probe[i]);
|
|
+
|
|
+ sr->radius_probe[i]->serverip = strdup(network_probe->list[i].serverIP);
|
|
+ size += strlen(network_probe->list[i].serverIP) + 1;
|
|
+ sr->radius_probe[i]->radiusstate = network_probe->list[i].radiusState;
|
|
+ sr->radius_probe[i]->has_radiusstate = true;
|
|
+ sr->radius_probe[i]->latency = network_probe->list[i].latency;
|
|
+ sr->radius_probe[i]->has_latency = true;
|
|
+ }
|
|
}
|
|
|
|
static void dppline_add_stat_bs_client(Sts__Report * r, dppline_stats_t * s)
|