wlan-ap-Telecominfraproject/feeds/wlan-ap/opensync/patches/21-sm-ubus-collector.patch
Damir Franusic be01395414 ubus_collector: hostapd data collector
* collect hostapd client session data via
  ubus and expose it to StatsManager (SM)

Signed-off-by: Damir Franusic <damir.franusic@netexperience.com>
2020-10-16 15:44:20 +02:00

62 lines
1.7 KiB
Diff

Index: opensync-2.0.5.0/src/sm/unit.mk
===================================================================
--- opensync-2.0.5.0.orig/src/sm/unit.mk
+++ opensync-2.0.5.0/src/sm/unit.mk
@@ -43,7 +43,8 @@ UNIT_SRC += src/sm_survey_report.c
UNIT_SRC += src/sm_radio_config.c
UNIT_SRC += src/sm_scan_schedule.c
UNIT_SRC += src/sm_rssi_report.c
-UNIT_SRC += src/sm_events_report.c
+UNIT_SRC += src/sm_events_report.c
+UNIT_SRC += src/ubus_collector.c
UNIT_SRC += src/ucc_report.c
UNIT_SRC += src/sm_common.c
@@ -59,6 +60,7 @@ UNIT_LDFLAGS += -lrt
UNIT_LDFLAGS += -lz
UNIT_LDFLAGS += -lnl-tiny -lubox
UNIT_LDFLAGS += -lcurl -lradiusclient
+UNIT_LDFLAGS += -lubus
UNIT_DEPS := src/lib/ovsdb
UNIT_DEPS += src/lib/pjs
Index: opensync-2.0.5.0/src/sm/src/sm_main.c
===================================================================
--- opensync-2.0.5.0.orig/src/sm/src/sm_main.c
+++ opensync-2.0.5.0/src/sm/src/sm_main.c
@@ -46,6 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
#include "dppline.h"
#include "os_backtrace.h"
#include "json_util.h"
+#include "ubus_collector.h"
#include "sm.h"
@@ -130,11 +131,15 @@ int main (int argc, char **argv)
return -1;
}
- if (sm_setup_monitor()) {
+ if (ubus_collector_init()) {
+ LOGE("Initializing ubus collector "
+ "(Failed to initialize ubus collector)");
return -1;
}
- backtrace_init();
+ if (sm_setup_monitor()) {
+ return -1;
+ }
ev_run(EV_DEFAULT, 0);
@@ -149,6 +154,8 @@ int main (int argc, char **argv)
ev_default_destroy();
+ ubus_collector_cleanup();
+
LOGN("Exiting SM");
return 0;