From 85779ee794d0d3e1e3bcd095dc53594d19751260 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Thu, 20 Nov 2025 00:54:32 +0100 Subject: [PATCH 01/17] Uahf POC#1 --- source/apps/uahf/server1.c | 164 +++++++++++++++++++++++ source/apps/uahf/uahf.c | 34 +++++ source/apps/uahf/uahf.h | 11 ++ source/apps/uahf/uahf_server.c | 185 ++++++++++++++++++++++++++ source/apps/uahf/uahf_server.h | 10 ++ source/apps/wifi_apps.c | 9 ++ source/core/wifi_ctrl_rbus_handlers.c | 14 +- 7 files changed, 426 insertions(+), 1 deletion(-) create mode 100644 source/apps/uahf/server1.c create mode 100644 source/apps/uahf/uahf.c create mode 100644 source/apps/uahf/uahf.h create mode 100644 source/apps/uahf/uahf_server.c create mode 100644 source/apps/uahf/uahf_server.h diff --git a/source/apps/uahf/server1.c b/source/apps/uahf/server1.c new file mode 100644 index 000000000..9c4cac176 --- /dev/null +++ b/source/apps/uahf/server1.c @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include +#include + +#define PORT 8080 +#define BUFFER_SIZE 4096 + +// --- URL decode helper --- +void url_decode(char *src, char *dest) { + char a, b; + while (*src) { + if ((*src == '%') && + ((a = src[1]) && (b = src[2])) && + (isxdigit(a) && isxdigit(b))) { + if (a >= 'a') a -= 'a' - 'A'; + if (a >= 'A') a -= ('A' - 10); + else a -= '0'; + if (b >= 'a') b -= 'a' - 'A'; + if (b >= 'A') b -= ('A' - 10); + else b -= '0'; + *dest++ = 16 * a + b; + src += 3; + } else if (*src == '+') { + *dest++ = ' '; + src++; + } else { + *dest++ = *src++; + } + } + *dest = '\0'; +} + +// --- Function to compose page dynamically --- +void send_html_page(int client_fd, int showThanks) +{ + char page[8000]; + + snprintf(page, sizeof(page), + "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html\r\n\r\n" + "" + "" + "OneWifi Web Server" + "" + "" + "" + "

OneWifi Web Server

"); + + if (showThanks) { + strcat(page, + "
Thank you for providing the details!
"); + } + + strcat(page, + "

Please enter your login details

" + "
" + "
" + "
" + "" + "
" + ""); + + write(client_fd, page, strlen(page)); +} + +int main() { + int server_fd, client_fd; + struct sockaddr_in addr; + socklen_t addrlen = sizeof(addr); + char buffer[BUFFER_SIZE]; + + server_fd = socket(AF_INET, SOCK_STREAM, 0); + if (server_fd == -1) { + perror("socket failed"); + exit(1); + } + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = INADDR_ANY; + addr.sin_port = htons(PORT); + if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + perror("bind failed"); + exit(1); + } + + listen(server_fd, 3); + printf("Server running on port %d...\n", PORT); + + while (1) { + client_fd = accept(server_fd, (struct sockaddr *)&addr, &addrlen); + if (client_fd < 0) { + perror("accept"); + continue; + } + + memset(buffer, 0, BUFFER_SIZE); + read(client_fd, buffer, BUFFER_SIZE); + + // ---- GET Request ---- + if (strncmp(buffer, "GET", 3) == 0) { + int showThanks = 0; + + if (strstr(buffer, "thanks=1")) + showThanks = 1; + + send_html_page(client_fd, showThanks); + } + + // ---- POST Request ---- + else if (strncmp(buffer, "POST", 4) == 0) { + + // Extract POST body (optional) + char *body = strstr(buffer, "\r\n\r\n"); + if (body) body += 4; + + char username[200] = {0}, password[200] = {0}; + char decoded[400]; + + char *u = strstr(body, "username="); + char *p = strstr(body, "password="); + + if (u && p) { + sscanf(u, "username=%199[^&]", username); + sscanf(p, "password=%199[^&]", password); + + url_decode(username, decoded); + strcpy(username, decoded); + + url_decode(password, decoded); + strcpy(password, decoded); + + printf("User submitted: %s / %s\n", username, password); + } + + printf("POST received - redirecting with thank you note...\n"); + + // Redirect to same page with thank-you flag + const char *redirect = + "HTTP/1.1 303 See Other\r\n" + "Location: /?thanks=1\r\n" + "Content-Length: 0\r\n" + "\r\n"; + + write(client_fd, redirect, strlen(redirect)); + } + + close(client_fd); + } + + return 0; +} + diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c new file mode 100644 index 000000000..72bdf1f36 --- /dev/null +++ b/source/apps/uahf/uahf.c @@ -0,0 +1,34 @@ +#include "uahf.h" +#include "uahf_server.h" +#include "stdlib.h" +#include "wifi_ctrl.h" +#include "wifi_hal.h" +#include "wifi_mgr.h" +#include "wifi_util.h" +#include +#include +#include +#include +#include + +int uahf_update(wifi_app_t *app) +{ + //launch_server + uahf_start_server(); + return RETURN_OK; +} + +int uahf_init(wifi_app_t *app, unsigned int create_flag) +{ + if (app_init(app, create_flag) != 0) { + return RETURN_ERR; + } + wifi_util_error_print(WIFI_APPS, "%s:%d: Init uahf\n", __func__, __LINE__); + + return RETURN_OK; +} + +int uahf_deinit(wifi_app_t *app) +{ + return RETURN_OK; +} diff --git a/source/apps/uahf/uahf.h b/source/apps/uahf/uahf.h new file mode 100644 index 000000000..92f6aa2e9 --- /dev/null +++ b/source/apps/uahf/uahf.h @@ -0,0 +1,11 @@ +#ifndef WIFI_UAHF_H +#define WIFI_UAHF_H + +#include "wifi_base.h" +typedef struct { + void *data; +} uahf_data_t; + +//typedef struct wifi_app wifi_app_t; + +#endif diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c new file mode 100644 index 000000000..5ca0355ca --- /dev/null +++ b/source/apps/uahf/uahf_server.c @@ -0,0 +1,185 @@ +#include +#include +#include +#include +#include +#include + +#define PORT 8080 +#define BUFFER_SIZE 4096 + +// --- URL decode helper --- +void url_decode(char *src, char *dest) { + char a, b; + while (*src) { + if ((*src == '%') && + ((a = src[1]) && (b = src[2])) && + (isxdigit(a) && isxdigit(b))) { + if (a >= 'a') a -= 'a' - 'A'; + if (a >= 'A') a -= ('A' - 10); + else a -= '0'; + if (b >= 'a') b -= 'a' - 'A'; + if (b >= 'A') b -= ('A' - 10); + else b -= '0'; + *dest++ = 16 * a + b; + src += 3; + } else if (*src == '+') { + *dest++ = ' '; + src++; + } else { + *dest++ = *src++; + } + } + *dest = '\0'; +} + +// --- Function to compose page dynamically --- +void send_html_page(int client_fd, int showThanks) +{ + char page[8000]; + + snprintf(page, sizeof(page), + "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html\r\n\r\n" + "" + "" + "OneWifi Web Server" + "" + "" + "" + "

OneWifi Web Server

"); + + if (showThanks) { + strcat(page, + "
Thank you for providing the details!
"); + } + + strcat(page, + "

Please enter your login details

" + "
" + "
" + "
" + "" + "
" + ""); + + write(client_fd, page, strlen(page)); +} + +int uahf_start_server() { + int server_fd, client_fd; + struct sockaddr_in addr; + socklen_t addrlen = sizeof(addr); + char buffer[BUFFER_SIZE]; + char username[200] = {0}, password[200] = {0}; + char decoded[400]; + + server_fd = socket(AF_INET, SOCK_STREAM, 0); + if (server_fd == -1) { + perror("socket failed"); + exit(1); + } + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = INADDR_ANY; + addr.sin_port = htons(PORT); + if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + perror("bind failed"); + exit(1); + } + + listen(server_fd, 3); + printf("Server running on port %d...\n", PORT); + + while (1) { + client_fd = accept(server_fd, (struct sockaddr *)&addr, &addrlen); + if (client_fd < 0) { + perror("accept"); + continue; + } + + memset(buffer, 0, BUFFER_SIZE); + read(client_fd, buffer, BUFFER_SIZE); + + // ---- GET Request ---- + if (strncmp(buffer, "GET", 3) == 0) { + int showThanks = 0; + + if (strstr(buffer, "thanks=1")) + showThanks = 1; + + send_html_page(client_fd, showThanks); + } + + // ---- POST Request ---- + else if (strncmp(buffer, "POST", 4) == 0) { + + // Extract POST body (optional) + char *body = strstr(buffer, "\r\n\r\n"); + if (body) body += 4; + + + char *u = strstr(body, "username="); + char *p = strstr(body, "password="); + + if (u && p) { + sscanf(u, "username=%199[^&]", username); + sscanf(p, "password=%199[^&]", password); + + url_decode(username, decoded); + strcpy(username, decoded); + + url_decode(password, decoded); + strcpy(password, decoded); + + printf("User submitted: %s / %s\n", username, password); + } + + printf("POST received - redirecting with thank you note...\n"); + + // Redirect to same page with thank-you flag + const char *redirect = + "HTTP/1.1 303 See Other\r\n" + "Location: /?thanks=1\r\n" + "Content-Length: 0\r\n" + "\r\n"; + + write(client_fd, redirect, strlen(redirect)); + } + + close(client_fd); + } + + char command_buffer[BUFFER_SIZE]; + int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", username); + system(command_buffer); + len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.16.SSID string %s", username); + system(command_buffer); + len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.24.SSID string %s", username); + system(command_buffer); + + len = snprintf( command_buffer, BUFFER_SIZE, + "dmcli eRT setv Device.WiFi.AccessPoint.15.Security.KeyPassphrase string %s", password); + system(command_buffer); + + len = snprintf( command_buffer, BUFFER_SIZE, + "dmcli eRT setv Device.WiFi.AccessPoint.16.Security.KeyPassphrase string %s", password); + system(command_buffer); + len = snprintf( command_buffer, BUFFER_SIZE, + "dmcli eRT setv Device.WiFi.AccessPoint.24.Security.KeyPassphrase string %s", password); + system(command_buffer); + + system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); + + return 0; +} + diff --git a/source/apps/uahf/uahf_server.h b/source/apps/uahf/uahf_server.h new file mode 100644 index 000000000..187973f48 --- /dev/null +++ b/source/apps/uahf/uahf_server.h @@ -0,0 +1,10 @@ +#ifndef WIFI_UAHF_SERVER_H +#define WIFI_UAHF_SERVER_H + +typedef struct { + void *data; +} uahf_server_data_t; + +int uahf_start_server(void); + +#endif diff --git a/source/apps/wifi_apps.c b/source/apps/wifi_apps.c index a7b1c7d02..a4082e71f 100644 --- a/source/apps/wifi_apps.c +++ b/source/apps/wifi_apps.c @@ -442,6 +442,15 @@ wifi_app_descriptor_t app_desc[] = { NULL, NULL }, #endif // ONEWIFI_EASYCONNECT_APP_SUPPORT +//#ifdef ONEWIFI_UAHF_APP_SUPPORT + { // co to robi + wifi_app_inst_uahf, 0, 0 + true, true, //drugie moze na false? + "UserAssistedHandOver", + uahf_init, NULL, uahf_deinit, + NULL, uahf_update + }, +//#endif //ONEWIFI_UAHF_APP_SUPPORT }; wifi_app_descriptor_t* get_app_desc(int *size){ diff --git a/source/core/wifi_ctrl_rbus_handlers.c b/source/core/wifi_ctrl_rbus_handlers.c index ea3651f1d..60955d5af 100644 --- a/source/core/wifi_ctrl_rbus_handlers.c +++ b/source/core/wifi_ctrl_rbus_handlers.c @@ -147,7 +147,19 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t ctrl->rf_status_down = rf_status; wifi_util_info_print(WIFI_CTRL, "%s:%d RF-Status : %d\n", __func__, __LINE__, ctrl->rf_status_down); start_station_vaps(rf_status); - + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] RF-Status : %d, enabled station vaps\n", __func__, __LINE__, ctrl->rf_status_down); + + wifi_apps_mgr_t *apps_mgr = NULL; + wifi_app_t *uahf_app = NULL; + if (ctrl != NULL) { + apps_mgr = &ctrl->apps_mgr; + uahf_app = (wifi_app_t *)get_app_by_inst(apps_mgr, wifi_app_inst_uahf); + if (uahf_app != NULL) { + uahf_app->desc.update_fn(uahf_app); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] started the server\n", __func__, __LINE__); + } else { + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); + } return rc; } From d6eab30877b304c6d525cfa22316ccd903ee5967 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Thu, 20 Nov 2025 05:04:35 +0100 Subject: [PATCH 02/17] Uahf POC#2, missing definitions and compile errors. --- include/wifi_base.h | 3 ++- source/apps/uahf/uahf_server.c | 1 + source/apps/wifi_apps.c | 5 ++++- source/apps/wifi_apps_mgr.h | 3 +++ source/core/Makefile.am | 6 +++++- source/core/wifi_ctrl_rbus_handlers.c | 1 + source/dml/dml_webconfig/Makefile.am | 2 +- source/dml/tr_181/ml/Makefile.am | 2 +- source/dml/tr_181/sbapi/Makefile.am | 2 +- source/platform/Makefile.am | 2 +- source/sampleapps/Makefile.am | 2 +- source/webconfig/Makefile.am | 2 +- 12 files changed, 22 insertions(+), 9 deletions(-) diff --git a/include/wifi_base.h b/include/wifi_base.h index f3a397649..71078e6ba 100644 --- a/include/wifi_base.h +++ b/include/wifi_base.h @@ -169,7 +169,8 @@ typedef enum { wifi_app_inst_sta_mgr = wifi_app_inst_base << 17, wifi_app_inst_memwraptool = wifi_app_inst_base << 18, wifi_app_inst_csi_analytics = wifi_app_inst_base << 19, - wifi_app_inst_max = wifi_app_inst_base << 20 + wifi_app_inst_uahf = wifi_app_inst_base << 20, + wifi_app_inst_max = wifi_app_inst_base << 21 } wifi_app_inst_t; typedef struct { diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c index 5ca0355ca..460ea2b48 100644 --- a/source/apps/uahf/uahf_server.c +++ b/source/apps/uahf/uahf_server.c @@ -161,6 +161,7 @@ int uahf_start_server() { char command_buffer[BUFFER_SIZE]; int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", username); + if (len == 0) printf("have to use this somewhere to disable -Wall error"); system(command_buffer); len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.16.SSID string %s", username); system(command_buffer); diff --git a/source/apps/wifi_apps.c b/source/apps/wifi_apps.c index a4082e71f..b50edd1b5 100644 --- a/source/apps/wifi_apps.c +++ b/source/apps/wifi_apps.c @@ -292,6 +292,9 @@ extern int sta_mgr_deinit(wifi_app_t *app); extern int sta_mgr_event(wifi_app_t *app, wifi_event_t *event); #endif +extern int uahf_init(wifi_app_t *app, unsigned int create_flag); +extern int uahf_deinit(wifi_app_t *app); +extern int uahf_update(wifi_app_t *app); wifi_app_descriptor_t app_desc[] = { #ifdef ONEWIFI_ANALYTICS_APP_SUPPORT { @@ -444,7 +447,7 @@ wifi_app_descriptor_t app_desc[] = { #endif // ONEWIFI_EASYCONNECT_APP_SUPPORT //#ifdef ONEWIFI_UAHF_APP_SUPPORT { // co to robi - wifi_app_inst_uahf, 0, 0 + wifi_app_inst_uahf, 0, 0, true, true, //drugie moze na false? "UserAssistedHandOver", uahf_init, NULL, uahf_deinit, diff --git a/source/apps/wifi_apps_mgr.h b/source/apps/wifi_apps_mgr.h index d03d46c64..0e62d8003 100644 --- a/source/apps/wifi_apps_mgr.h +++ b/source/apps/wifi_apps_mgr.h @@ -55,6 +55,8 @@ extern "C" { #include "wifi_easyconnect.h" #endif // ONEWIFI_EASYCONNECT_APP_SUPPORT +#include "uahf.h" + #define MAX_APP_INIT_DATA 1024 #define APP_DETACHED 0x01 @@ -102,6 +104,7 @@ typedef struct { em_data_t em_data; #endif //EM_APP memwraptool_config_t memwraptool; + uahf_data_t uahf_data; } u; } wifi_app_data_t; diff --git a/source/core/Makefile.am b/source/core/Makefile.am index 09088fc81..c396a6f64 100644 --- a/source/core/Makefile.am +++ b/source/core/Makefile.am @@ -78,13 +78,15 @@ endif OneWifi_CPPFLAGS += -I$(top_srcdir)/source/dml/rdkb/ OneWifi_CPPFLAGS += -I$(top_srcdir)/source/dml/dml_webconfig -OneWifi_CPPFLAGS += -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/memwraptool +OneWifi_CPPFLAGS += -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/uahf -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/memwraptool OneWifi_CFLAGS = $(SYSTEMD_CFLAGS) OneWifi_CFLAGS += $(JOURNALCTL_ENABLE_FLAG) OneWifi_CFLAGS += $(SM_APP_FLAG) OneWifi_CFLAGS += $(EM_APP_FLAG) OneWifi_CFLAGS += -I${PKG_CONFIG_SYSROOT_DIR}/usr/include/protobuf-c +OneWifi_CFLAGS += -I$(top_srcdir)/source/apps/uahf + OneWifi_SOURCES = wifi_mgr.c wifi_ctrl.c wifi_passpoint.c wifi_8021x.c wifi_data_plane.c wifi_ctrl_queue_handlers.c wifi_ctrl_rbus_handlers.c wifi_multidoc_webconfig.c wifi_ctrl_webconfig.c wifi_ctrl_wifiapi_handlers.c @@ -158,6 +160,8 @@ if ONEWIFI_STA_MGR_APP_SUPPORT OneWifi_SOURCES += $(top_srcdir)/source/apps/sta_mgr/wifi_sta_mgr.c endif +OneWifi_SOURCES += $(top_srcdir)/source/apps/uahf/uahf.c $(top_srcdir)/source/apps/uahf/uahf_server.c + if SM_APP_SUPPORT OneWifi_SOURCES += $(top_srcdir)/source/apps/sm/wifi_sm.c $(top_srcdir)/source/apps/sm/sm_utils.c $(top_srcdir)/source/apps/sm/sm_report.c $(top_srcdir)/source/apps/sm/sm_client_cache.c $(top_srcdir)/source/apps/sm/sm_client_report.c $(top_srcdir)/source/apps/sm/sm_survey_cache.c $(top_srcdir)/source/apps/sm/sm_survey_report.c $(top_srcdir)/source/apps/sm/sm_neighbor_cache.c $(top_srcdir)/source/apps/sm/sm_neighbor_report.c endif diff --git a/source/core/wifi_ctrl_rbus_handlers.c b/source/core/wifi_ctrl_rbus_handlers.c index 60955d5af..cdc2ba0af 100644 --- a/source/core/wifi_ctrl_rbus_handlers.c +++ b/source/core/wifi_ctrl_rbus_handlers.c @@ -160,6 +160,7 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t } else { wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); } + } return rc; } diff --git a/source/dml/dml_webconfig/Makefile.am b/source/dml/dml_webconfig/Makefile.am index e54acea8c..2e206c628 100644 --- a/source/dml/dml_webconfig/Makefile.am +++ b/source/dml/dml_webconfig/Makefile.am @@ -44,7 +44,7 @@ hardware_platform = i686-linux-gnu noinst_LTLIBRARIES = libCcspWifiAgent_dml_webconfig.la -libCcspWifiAgent_dml_webconfig_la_CPPFLAGS = -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/lib/const -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/rdkb/ -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/dml/rdkb/ -I$(top_srcdir)/source/stubs $(CPPFLAGS) +libCcspWifiAgent_dml_webconfig_la_CPPFLAGS = -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/lib/const -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/rdkb/ -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/dml/rdkb/ -I$(top_srcdir)/source/stubs -I$(top_srcdir)/source/apps/uahf $(CPPFLAGS) libCcspWifiAgent_dml_webconfig_la_CPPFLAGS += $(EM_APP_FLAG) libCcspWifiAgent_dml_webconfig_la_SOURCES = dml_onewifi_api.c diff --git a/source/dml/tr_181/ml/Makefile.am b/source/dml/tr_181/ml/Makefile.am index 964422ba2..c28193d4c 100644 --- a/source/dml/tr_181/ml/Makefile.am +++ b/source/dml/tr_181/ml/Makefile.am @@ -42,7 +42,7 @@ ACLOCAL_AMFLAGS = -I m4 hardware_platform = i686-linux-gnu noinst_LTLIBRARIES = libCcspWifiAgent_ml.la -libCcspWifiAgent_ml_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/source/utils -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/inc -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/rdkb -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/ccsp/ -I$(top_srcdir)/source/dml/rdkb/ $(CPPFLAGS) +libCcspWifiAgent_ml_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/source/utils -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/inc -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/rdkb -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/ccsp/ -I$(top_srcdir)/source/dml/rdkb/ -I$(top_srcdir)/source/apps/uahf $(CPPFLAGS) libCcspWifiAgent_ml_la_CPPFLAGS += $(EM_APP_FLAG) libCcspWifiAgent_ml_la_SOURCES = plugin_main.c cosa_apis_util.c plugin_main_apis.c cosa_wifi_dml.c cosa_apis_busutil.c cosa_wifi_internal.c cosa_logging_internal.c cosa_logging_dml.c cosa_harvester_dml.c diff --git a/source/dml/tr_181/sbapi/Makefile.am b/source/dml/tr_181/sbapi/Makefile.am index 543f7f957..307c66ebf 100644 --- a/source/dml/tr_181/sbapi/Makefile.am +++ b/source/dml/tr_181/sbapi/Makefile.am @@ -46,7 +46,7 @@ hardware_platform = i686-linux-gnu noinst_LTLIBRARIES = libCcspWifiAgent_sbapi.la -libCcspWifiAgent_sbapi_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/inc -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/rbus -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/db -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/ccsp/ -I$(top_srcdir)/source/dml/rdkb/ $(CPPFLAGS) +libCcspWifiAgent_sbapi_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/inc -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/rbus -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/db -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/ccsp/ -I$(top_srcdir)/source/dml/rdkb/ -I$(top_srcdir)/source/apps/uahf $(CPPFLAGS) if ONEWIFI_DBUS_SUPPORT libCcspWifiAgent_sbapi_la_CPPFLAGS += -I$(top_srcdir)/source/platform/dbus -I${PKG_CONFIG_SYSROOT_DIR}/$(includedir)/dbus-1.0 -I${PKG_CONFIG_SYSROOT_DIR}/usr/lib/dbus-1.0/include diff --git a/source/platform/Makefile.am b/source/platform/Makefile.am index 35b133055..dff3ff5e6 100644 --- a/source/platform/Makefile.am +++ b/source/platform/Makefile.am @@ -40,7 +40,7 @@ libwifi_bus_la_LDFLAGS = -L$(top_builddir)/source/utils/ libwifi_bus_la_LDFLAGS += -L$(top_builddir)/source/webconfig/ libwifi_bus_la_LDFLAGS += -lwifi_webconfig -libwifi_bus_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/source/platform/ -I/var/tmp/pc-rdkb/include/dbus-1.0 -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/inc -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common/ -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/dml/rdkb +libwifi_bus_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/source/platform/ -I/var/tmp/pc-rdkb/include/dbus-1.0 -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/inc -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common/ -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/dml/rdkb -I$(top_srcdir)/source/apps/uahf libwifi_bus_la_SOURCES = $(top_srcdir)/source/platform/common/bus_common.c diff --git a/source/sampleapps/Makefile.am b/source/sampleapps/Makefile.am index e5a2bd138..e419b1927 100644 --- a/source/sampleapps/Makefile.am +++ b/source/sampleapps/Makefile.am @@ -42,7 +42,7 @@ ACLOCAL_AMFLAGS = -I m4 hardware_platform = i686-linux-gnu bin_PROGRAMS = onewifi_component_test_app -onewifi_component_test_app_CPPFLAGS = $(CPPFLAGS) -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/./include -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/rbus -I$(top_srcdir)/../hal/include -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core -I$(top_srcdir)/source/db -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/./lib/ovsdb -I$(top_srcdir)/./lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/./lib/json_util/ -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/rdkb -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/dml/rdkb +onewifi_component_test_app_CPPFLAGS = $(CPPFLAGS) -I$(top_srcdir)/source/apps/em -I$(top_srcdir)/./include -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/rbus -I$(top_srcdir)/../hal/include -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core -I$(top_srcdir)/source/db -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/./lib/ovsdb -I$(top_srcdir)/./lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/./lib/json_util/ -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/rdkb -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/dml/rdkb -I$(top_srcdir)/source/apps/uahf onewifi_component_test_app_SOURCES = wifi_webconfig_consumer.c webconfig_consumer_apis.c webconfig_consumer_cli.c diff --git a/source/webconfig/Makefile.am b/source/webconfig/Makefile.am index 7b639877a..644798fbc 100644 --- a/source/webconfig/Makefile.am +++ b/source/webconfig/Makefile.am @@ -57,7 +57,7 @@ hardware_platform = i686-linux-gnu lib_LTLIBRARIES=libwifi_webconfig.la -libwifi_webconfig_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I/var/tmp/pc-rdkb/include/dbus-1.0 -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/memwraptool -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/dml/rdkb -I$(top_srcdir)/source/ccsp/ $(CPPFLAGS) +libwifi_webconfig_la_CPPFLAGS = -I$(top_srcdir)/source/apps/uahf -I$(top_srcdir)/source/apps/em -I/var/tmp/pc-rdkb/include/dbus-1.0 -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/memwraptool -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/dml/rdkb -I$(top_srcdir)/source/ccsp/ $(CPPFLAGS) if ONEWIFI_DBUS_SUPPORT libwifi_webconfig_la_CPPFLAGS += -I$(top_srcdir)/source/platform/dbus -I${PKG_CONFIG_SYSROOT_DIR}/$(includedir)/dbus-1.0 -I${PKG_CONFIG_SYSROOT_DIR}/usr/lib/dbus-1.0/include/ From 1753f081129d33433725d19f2cb37d8431abfc37 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Thu, 20 Nov 2025 20:30:01 +0100 Subject: [PATCH 03/17] Uahf POC#3, yet again missing Makefile.am include flags --- source/utils/Makefile.am | 3 +++ source/webconfig/Makefile.am | 2 ++ 2 files changed, 5 insertions(+) diff --git a/source/utils/Makefile.am b/source/utils/Makefile.am index 015f72281..74e6f2ce3 100644 --- a/source/utils/Makefile.am +++ b/source/utils/Makefile.am @@ -67,6 +67,9 @@ libwifi_utils_la_CFLAGS = $(SYSTEMD_CFLAGS) libwifi_utils_la_CFLAGS += $(DML_ENABLE_FLAG) libwifi_utils_la_SOURCES = wifi_validator.c libwifi_utils_la_SOURCES += ext_blaster.pb-c.c +libwifi_utils_la_CFLAGS += -I$(top_srcdir)/source/apps/uahf +libwifi_utils_la_CPPFLAGS += -I$(top_srcdir)/source/apps/uahf + libwifi_utils_la_LDFLAGS = -rdynamic -lwebconfig_framework -lsecure_wrapper $(SYSTEMD_LDFLAGS) -lsecure_wrapper -lmsgpackc -lcjson -lm -ljansson -static diff --git a/source/webconfig/Makefile.am b/source/webconfig/Makefile.am index 644798fbc..57e87719f 100644 --- a/source/webconfig/Makefile.am +++ b/source/webconfig/Makefile.am @@ -74,6 +74,8 @@ if EM_APP_SUPPORT libwifi_webconfig_la_SOURCES += wifi_webconfig_em_channel_stats.c wifi_webconfig_em_sta_link_metrics.c wifi_webconfig_em_ap_metrics_report.c libwifi_webconfig_la_CFLAGS += $(EM_APP_FLAG) endif +libwifi_webconfig_la_CFLAGS += -I$(top_srcdir)/source/apps/uahf +libwifi_webconfig_la_CPPFLAGS += -I$(top_srcdir)/source/apps/uahf if WITH_EASYMESH libwifi_webconfig_la_SOURCES += wifi_easymesh_translator.c From 269278eed9cd623d7fd7c754b1429d13cbb8fdae Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Thu, 20 Nov 2025 21:29:50 +0100 Subject: [PATCH 04/17] . --- source/utils/Makefile.am | 4 +--- source/webconfig/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/source/utils/Makefile.am b/source/utils/Makefile.am index 74e6f2ce3..56c9cbcb1 100644 --- a/source/utils/Makefile.am +++ b/source/utils/Makefile.am @@ -55,7 +55,7 @@ hardware_platform = i686-linux-gnu lib_LTLIBRARIES=libwifi_utils.la -libwifi_utils_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I/var/tmp/pc-rdkb/include/dbus-1.0 -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/inc -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common/ -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/dml/rdkb -I$(top_srcdir)/source/apps/sta_mgr +libwifi_utils_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I/var/tmp/pc-rdkb/include/dbus-1.0 -I$(top_srcdir)/source/apps/uahf -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/source/dml/wifi_ssp -I$(top_srcdir)/source/dml/dml_webconfig -I$(top_srcdir)/source/dml/tr_181/ml -I$(top_srcdir)/source/dml/tr_181/sbapi -I$(top_srcdir)/include/tr_181/ml -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/inc -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common/ -I$(top_srcdir)/source/ccsp -I$(top_srcdir)/source/dml/rdkb -I$(top_srcdir)/source/apps/sta_mgr if ONEWIFI_DBUS_SUPPORT libwifi_utils_la_CPPFLAGS += -I$(top_srcdir)/source/platform/dbus -I${PKG_CONFIG_SYSROOT_DIR}/$(includedir)/dbus-1.0 -I${PKG_CONFIG_SYSROOT_DIR}/usr/lib/dbus-1.0/include/ $(CPPFLAGS) @@ -68,8 +68,6 @@ libwifi_utils_la_CFLAGS += $(DML_ENABLE_FLAG) libwifi_utils_la_SOURCES = wifi_validator.c libwifi_utils_la_SOURCES += ext_blaster.pb-c.c libwifi_utils_la_CFLAGS += -I$(top_srcdir)/source/apps/uahf -libwifi_utils_la_CPPFLAGS += -I$(top_srcdir)/source/apps/uahf - libwifi_utils_la_LDFLAGS = -rdynamic -lwebconfig_framework -lsecure_wrapper $(SYSTEMD_LDFLAGS) -lsecure_wrapper -lmsgpackc -lcjson -lm -ljansson -static diff --git a/source/webconfig/Makefile.am b/source/webconfig/Makefile.am index 57e87719f..18fd79d8e 100644 --- a/source/webconfig/Makefile.am +++ b/source/webconfig/Makefile.am @@ -57,7 +57,7 @@ hardware_platform = i686-linux-gnu lib_LTLIBRARIES=libwifi_webconfig.la -libwifi_webconfig_la_CPPFLAGS = -I$(top_srcdir)/source/apps/uahf -I$(top_srcdir)/source/apps/em -I/var/tmp/pc-rdkb/include/dbus-1.0 -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/memwraptool -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/dml/rdkb -I$(top_srcdir)/source/ccsp/ $(CPPFLAGS) +libwifi_webconfig_la_CPPFLAGS = -I$(top_srcdir)/source/apps/em -I/var/tmp/pc-rdkb/include/dbus-1.0 -I$(top_srcdir)/source/apps/uahf -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/custom -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/include -I$(top_srcdir)/../CcspCommonLibrary/source/debug_api/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/include/linux -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/include -I$(top_srcdir)/../CcspCommonLibrary/source/cosa/package/slap/include -I$(top_srcdir)/../hal/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/http/include -I$(top_srcdir)/../CcspCommonLibrary/source/util_api/ansc/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/MessageBusHelper/include -I$(top_srcdir)/../CcspCommonLibrary/source/ccsp/components/common/PoamIrepFolder -I$(top_srcdir)/include/wifi_ssp -I$(top_srcdir)/./include -I$(top_srcdir)/source/core -I$(top_srcdir)/source/stats -I$(top_srcdir)/source/db -I$(top_srcdir)/lib/ovsdb -I$(top_srcdir)/lib/json_util -I$(top_srcdir)/lib/ds -I$(top_srcdir)/lib/common -I$(top_srcdir)/lib/pjs -I$(top_srcdir)/lib/log -I$(top_srcdir)/lib/const -I$(top_srcdir)/lib/schema -I$(top_srcdir)/lib/osp -I$(top_srcdir)/lib/osa -I$(top_srcdir)/lib/psfs -I$(top_srcdir)/lib/qm -I$(top_srcdir)/source/utils -I$(top_srcdir)/source/core/services -I$(top_srcdir)/source/apps -I$(top_srcdir)/source/apps/analytics -I$(top_srcdir)/source/apps/levl -I$(top_srcdir)/source/apps/sta_mgr -I$(top_srcdir)/source/apps/cac -I$(top_srcdir)/source/apps/sm -I$(top_srcdir)/source/apps/csi -I$(top_srcdir)/source/apps/motion -I$(top_srcdir)/source/apps/whix -I$(top_srcdir)/source/apps/harvester -I$(top_srcdir)/source/apps/blaster -I$(top_srcdir)/source/apps/memwraptool -I$(top_srcdir)/source/apps/ocs -I$(top_srcdir)/source/platform/common -I$(top_srcdir)/source/dml/rdkb -I$(top_srcdir)/source/ccsp/ $(CPPFLAGS) if ONEWIFI_DBUS_SUPPORT libwifi_webconfig_la_CPPFLAGS += -I$(top_srcdir)/source/platform/dbus -I${PKG_CONFIG_SYSROOT_DIR}/$(includedir)/dbus-1.0 -I${PKG_CONFIG_SYSROOT_DIR}/usr/lib/dbus-1.0/include/ From d33a0c374d14e560c05cdb6eb02ff6b03e7044a5 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Thu, 20 Nov 2025 23:25:33 +0100 Subject: [PATCH 05/17] ** --- source/apps/uahf/uahf_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c index 460ea2b48..2de235390 100644 --- a/source/apps/uahf/uahf_server.c +++ b/source/apps/uahf/uahf_server.c @@ -5,7 +5,7 @@ #include #include -#define PORT 8080 +#define PORT 9191 #define BUFFER_SIZE 4096 // --- URL decode helper --- From b9754579647f5f2a5d1c672266e17f3537178175 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Fri, 21 Nov 2025 22:13:07 +0100 Subject: [PATCH 06/17] ... --- source/apps/uahf/uahf.c | 124 +++++++++++++++++++++++++- source/apps/uahf/uahf.h | 10 +++ source/apps/uahf/uahf_server.c | 23 +++-- source/core/wifi_ctrl.c | 2 +- source/core/wifi_ctrl_rbus_handlers.c | 4 +- 5 files changed, 151 insertions(+), 12 deletions(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index 72bdf1f36..1f812c30c 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -11,15 +11,120 @@ #include #include -int uahf_update(wifi_app_t *app) -{ - //launch_server - uahf_start_server(); +void* uahf_worker_task(void* arg) { + wifi_app_t* app = (wifi_app_t*)arg; + uahf_data_t* d = GET_UAHF(app); + + // 1. Run the server directly (BLOCKING) + // This will sit here until the user submits the form and the loop breaks + uahf_start_server(app); + + // 2. Update State (Critical Section) + pthread_mutex_lock(&app->lock); + + d->worker_running = false; + d->worker_done = true; // Signal main thread that data is in d->username/password + pthread_mutex_unlock(&app->lock); + + wifi_util_error_print(WIFI_APPS, "UAHF Result: User=%s, Pass=%s\n", + d->username, d->password); + + // Pass to AppMgr or other logic + // process_login(d->username, d->password); +#define BUFFER_SIZE 4096 + char command_buffer[BUFFER_SIZE]; + int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", username); + if (len == 0) printf("have to use this somewhere to disable -Wall error"); + wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 15\n", __func__, __LINE__); + + system(command_buffer); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 15\n", __func__, __LINE__); + + len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.16.SSID string %s", username); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 16\n", __func__, __LINE__); + + system(command_buffer); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 24\n", __func__, __LINE__); + + len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.24.SSID string %s", username); + system(command_buffer); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 24\n", __func__, __LINE__); + + len = snprintf( command_buffer, BUFFER_SIZE, + "dmcli eRT setv Device.WiFi.AccessPoint.15.Security.KeyPassphrase string %s", password); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set psk for vap 15\n", __func__, __LINE__); + + system(command_buffer); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 15\n", __func__, __LINE__); + + len = snprintf( command_buffer, BUFFER_SIZE, + "dmcli eRT setv Device.WiFi.AccessPoint.16.Security.KeyPassphrase string %s", password); + +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set psk for vap 16\n", __func__, __LINE__); + + system(command_buffer); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 16\n", __func__, __LINE__); + + len = snprintf( command_buffer, BUFFER_SIZE, + "dmcli eRT setv Device.WiFi.AccessPoint.24.Security.KeyPassphrase string %s", password); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set psk for vap 24\n", __func__, __LINE__); + + system(command_buffer); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 24, call apply\n", __func__, __LINE__); + + system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called apply ap settings\n", __func__, __LINE__); + + + return NULL; +} + +int uahf_update(wifi_app_t *app) { + uahf_data_t* d = GET_UAHF(app); + + // --- Trigger Server --- + if (!d->worker_running && !d->worker_done) { + pthread_mutex_lock(&app->lock); + pthread_mutex_lock(&app->lock); + + // Clear old data just in case + memset(d->username, 0, sizeof(d->username)); + memset(d->password, 0, sizeof(d->password)); + + d->worker_running = true; + + if (pthread_create(&d->worker_tid, NULL, uahf_worker_task, app) == 0) { + pthread_detach(d->worker_tid); + } else { + d->worker_running = false; + } + pthread_mutex_unlock(&app->lock); + + } + // --- Process Results -- + // dead cpde for now + if (d->worker_done) { + pthread_mutex_lock(&app->lock); + if (d->worker_done) { + + // SUCCESS: Data is now available directly in the struct + wifi_util_error_print(WIFI_APPS, "UAHF Result: User=%s, Pass=%s\n", + d->username, d->password); + + + d->worker_done = false; + } + pthread_mutex_unlock(&app->lock); + } + return RETURN_OK; } int uahf_init(wifi_app_t *app, unsigned int create_flag) { + + memset(&app->data.u.uahf_data, 0, sizeof(uahf_data_t)); if (app_init(app, create_flag) != 0) { return RETURN_ERR; } @@ -32,3 +137,14 @@ int uahf_deinit(wifi_app_t *app) { return RETURN_OK; } + +/* +int my_app_deinit(wifi_app_t* app) { + MyHttpState* state = GET_STATE(app); + if (state->worker_running) { + // In a real app, you'd kill the thread or wait. + // For a demo, a small sleep or warning is sufficient. + printf("Warning: App closing while worker is active.\n"); + } + return 0; + */ diff --git a/source/apps/uahf/uahf.h b/source/apps/uahf/uahf.h index 92f6aa2e9..39a445471 100644 --- a/source/apps/uahf/uahf.h +++ b/source/apps/uahf/uahf.h @@ -1,9 +1,19 @@ #ifndef WIFI_UAHF_H #define WIFI_UAHF_H +#include #include "wifi_base.h" + typedef struct { void *data; +// Thread Management + pthread_t worker_tid; + bool worker_running; + bool worker_done; + + // Data Buffers + char input_cmd_data[1024]; // Data going INTO the system command + char output_server_data[2048]; // Data coming OUT of the server } uahf_data_t; //typedef struct wifi_app wifi_app_t; diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c index 2de235390..fdaac0671 100644 --- a/source/apps/uahf/uahf_server.c +++ b/source/apps/uahf/uahf_server.c @@ -4,7 +4,10 @@ #include #include #include - +#include "wifi_ctrl.h" +#include "wifi_hal.h" +#include "wifi_mgr.h" +#include "wifi_util.h" #define PORT 9191 #define BUFFER_SIZE 4096 @@ -75,12 +78,13 @@ void send_html_page(int client_fd, int showThanks) write(client_fd, page, strlen(page)); } -int uahf_start_server() { +int uahf_start_server(wifi_app_t *app) { + uahf_data_t *d = GET_UAHF(app); // Access your specific data int server_fd, client_fd; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); char buffer[BUFFER_SIZE]; - char username[200] = {0}, password[200] = {0}; + char username_local[200] = {0}, password_local[200] = {0}; char decoded[400]; server_fd = socket(AF_INET, SOCK_STREAM, 0); @@ -141,6 +145,8 @@ int uahf_start_server() { url_decode(password, decoded); strcpy(password, decoded); + strncpy(d->username, username_local, sizeof(d->username)-1); + strncpy(d->password, password_local, sizeof(d->password)-1); printf("User submitted: %s / %s\n", username, password); } @@ -154,11 +160,18 @@ int uahf_start_server() { "\r\n"; write(client_fd, redirect, strlen(redirect)); + + // --- 2. EXIT LOOP CONDITION --- + // If we successfully captured data, we break the loop + // so the function returns and the worker thread can finish. + if (strlen(d->username) > 0) { + break; + } } close(client_fd); } - +/* char command_buffer[BUFFER_SIZE]; int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", username); if (len == 0) printf("have to use this somewhere to disable -Wall error"); @@ -180,7 +193,7 @@ int uahf_start_server() { system(command_buffer); system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); - + */ return 0; } diff --git a/source/core/wifi_ctrl.c b/source/core/wifi_ctrl.c index 73bb827dc..4b180abac 100644 --- a/source/core/wifi_ctrl.c +++ b/source/core/wifi_ctrl.c @@ -283,7 +283,7 @@ void sta_selfheal_handing(wifi_ctrl_t *ctrl, vap_svc_t *l_svc) bool is_sta_enabled(void) { wifi_ctrl_t *ctrl = (wifi_ctrl_t *)get_wifictrl_obj(); - wifi_util_dbg_print(WIFI_CTRL,"[%s:%d] device mode:%d active_gw_check:%d and rf_status_down=%d\r\n", + wifi_util_error_print(WIFI_CTRL,"[%s:%d] device mode:%d active_gw_check:%d and rf_status_down=%d\r\n", __func__, __LINE__, ctrl->network_mode, ctrl->active_gw_check, ctrl->rf_status_down); return ((ctrl->network_mode == rdk_dev_mode_type_ext || ctrl->network_mode == rdk_dev_mode_type_em_node || ctrl->active_gw_check == true || diff --git a/source/core/wifi_ctrl_rbus_handlers.c b/source/core/wifi_ctrl_rbus_handlers.c index cdc2ba0af..084327ad8 100644 --- a/source/core/wifi_ctrl_rbus_handlers.c +++ b/source/core/wifi_ctrl_rbus_handlers.c @@ -145,9 +145,9 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t return rc; } ctrl->rf_status_down = rf_status; - wifi_util_info_print(WIFI_CTRL, "%s:%d RF-Status : %d\n", __func__, __LINE__, ctrl->rf_status_down); + wifi_util_info_print(WIFI_CTRL, "%s:%d RFStatus : %d\n", __func__, __LINE__, ctrl->rf_status_down); start_station_vaps(rf_status); - wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] RF-Status : %d, enabled station vaps\n", __func__, __LINE__, ctrl->rf_status_down); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : %d, enabled station vaps\n", __func__, __LINE__, ctrl->rf_status_down); wifi_apps_mgr_t *apps_mgr = NULL; wifi_app_t *uahf_app = NULL; From 9e985029a9b30a4480441650cffe3df8ed493561 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Fri, 21 Nov 2025 23:22:59 +0100 Subject: [PATCH 07/17] ..... --- source/apps/uahf/uahf.c | 40 ++++++++++++------------- source/apps/uahf/uahf.h | 8 ++--- source/apps/uahf/uahf_server.c | 33 +++++++++----------- source/apps/uahf/uahf_server.h | 7 +++-- source/core/services/vap_svc_mesh_ext.c | 12 ++++++++ source/core/wifi_ctrl_rbus_handlers.c | 4 +-- 6 files changed, 57 insertions(+), 47 deletions(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index 1f812c30c..e86d958cb 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -26,55 +26,55 @@ void* uahf_worker_task(void* arg) { d->worker_done = true; // Signal main thread that data is in d->username/password pthread_mutex_unlock(&app->lock); - wifi_util_error_print(WIFI_APPS, "UAHF Result: User=%s, Pass=%s\n", + wifi_util_error_print(WIFI_CTRL, "UAHF Result: User=%s, Pass=%s\n", d->username, d->password); // Pass to AppMgr or other logic // process_login(d->username, d->password); #define BUFFER_SIZE 4096 char command_buffer[BUFFER_SIZE]; - int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", username); + int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", d->username); if (len == 0) printf("have to use this somewhere to disable -Wall error"); - wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 15\n", __func__, __LINE__); + wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set ssid for vap 15\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 15\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set ssid for vap 15\n", __func__, __LINE__); - len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.16.SSID string %s", username); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 16\n", __func__, __LINE__); + len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.16.SSID string %s", d->username); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set ssid for vap 16\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 16\n", __func__, __LINE__); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 24\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set ssid for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set ssid for vap 24\n", __func__, __LINE__); - len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.24.SSID string %s", username); + len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.24.SSID string %s", d->username); system(command_buffer); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 24\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set ssid for vap 24\n", __func__, __LINE__); len = snprintf( command_buffer, BUFFER_SIZE, - "dmcli eRT setv Device.WiFi.AccessPoint.15.Security.KeyPassphrase string %s", password); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set psk for vap 15\n", __func__, __LINE__); + "dmcli eRT setv Device.WiFi.AccessPoint.15.Security.KeyPassphrase string %s", d->password); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set psk for vap 15\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 15\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 15\n", __func__, __LINE__); len = snprintf( command_buffer, BUFFER_SIZE, - "dmcli eRT setv Device.WiFi.AccessPoint.16.Security.KeyPassphrase string %s", password); + "dmcli eRT setv Device.WiFi.AccessPoint.16.Security.KeyPassphrase string %s", d->password); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set psk for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set psk for vap 16\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 16\n", __func__, __LINE__); len = snprintf( command_buffer, BUFFER_SIZE, - "dmcli eRT setv Device.WiFi.AccessPoint.24.Security.KeyPassphrase string %s", password); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set psk for vap 24\n", __func__, __LINE__); + "dmcli eRT setv Device.WiFi.AccessPoint.24.Security.KeyPassphrase string %s", d->password); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set psk for vap 24\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 24, call apply\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 24, call apply\n", __func__, __LINE__); system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called apply ap settings\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called apply ap settings\n", __func__, __LINE__); return NULL; diff --git a/source/apps/uahf/uahf.h b/source/apps/uahf/uahf.h index 39a445471..3da387b8d 100644 --- a/source/apps/uahf/uahf.h +++ b/source/apps/uahf/uahf.h @@ -11,11 +11,11 @@ typedef struct { bool worker_running; bool worker_done; - // Data Buffers - char input_cmd_data[1024]; // Data going INTO the system command - char output_server_data[2048]; // Data coming OUT of the server + // Result Data + char username[200]; // To store captured username + char password[200]; // To store captured password } uahf_data_t; - +#define GET_UAHF(app) (&((app)->data.u.uahf_data)) //typedef struct wifi_app wifi_app_t; #endif diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c index fdaac0671..4de6eb9b7 100644 --- a/source/apps/uahf/uahf_server.c +++ b/source/apps/uahf/uahf_server.c @@ -79,7 +79,7 @@ void send_html_page(int client_fd, int showThanks) } int uahf_start_server(wifi_app_t *app) { - uahf_data_t *d = GET_UAHF(app); // Access your specific data + uahf_data_t *d = (uahf_data_t *)GET_UAHF(app); // Access your specific data int server_fd, client_fd; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); @@ -102,7 +102,7 @@ int uahf_start_server(wifi_app_t *app) { } listen(server_fd, 3); - printf("Server running on port %d...\n", PORT); + fprintf(stderr,"Server running on port %d...\n", PORT); while (1) { client_fd = accept(server_fd, (struct sockaddr *)&addr, &addrlen); @@ -122,6 +122,8 @@ int uahf_start_server(wifi_app_t *app) { showThanks = 1; send_html_page(client_fd, showThanks); + if (showThanks) + break; } // ---- POST Request ---- @@ -136,21 +138,21 @@ int uahf_start_server(wifi_app_t *app) { char *p = strstr(body, "password="); if (u && p) { - sscanf(u, "username=%199[^&]", username); - sscanf(p, "password=%199[^&]", password); + sscanf(u, "username=%199[^&]", username_local); + sscanf(p, "password=%199[^&]", password_local); - url_decode(username, decoded); - strcpy(username, decoded); + url_decode(username_local, decoded); + strcpy(username_local, decoded); - url_decode(password, decoded); - strcpy(password, decoded); + url_decode(password_local, decoded); + strcpy(password_local, decoded); - strncpy(d->username, username_local, sizeof(d->username)-1); - strncpy(d->password, password_local, sizeof(d->password)-1); - printf("User submitted: %s / %s\n", username, password); + strncpy(d->username, username_local, 100); + strncpy(d->password, password_local, 100); + fprintf(stderr,"User submitted: %s / %s\n", username_local, password_local); } - printf("POST received - redirecting with thank you note...\n"); + fprintf(stderr, "POST received - redirecting with thank you note...\n"); // Redirect to same page with thank-you flag const char *redirect = @@ -160,13 +162,6 @@ int uahf_start_server(wifi_app_t *app) { "\r\n"; write(client_fd, redirect, strlen(redirect)); - - // --- 2. EXIT LOOP CONDITION --- - // If we successfully captured data, we break the loop - // so the function returns and the worker thread can finish. - if (strlen(d->username) > 0) { - break; - } } close(client_fd); diff --git a/source/apps/uahf/uahf_server.h b/source/apps/uahf/uahf_server.h index 187973f48..66b7aa624 100644 --- a/source/apps/uahf/uahf_server.h +++ b/source/apps/uahf/uahf_server.h @@ -1,10 +1,13 @@ #ifndef WIFI_UAHF_SERVER_H #define WIFI_UAHF_SERVER_H - +#include "wifi_ctrl.h" +#include "wifi_hal.h" +#include "wifi_mgr.h" +#include "wifi_util.h" typedef struct { void *data; } uahf_server_data_t; -int uahf_start_server(void); +int uahf_start_server(wifi_app_t *); #endif diff --git a/source/core/services/vap_svc_mesh_ext.c b/source/core/services/vap_svc_mesh_ext.c index b3a741a9d..2281c4454 100644 --- a/source/core/services/vap_svc_mesh_ext.c +++ b/source/core/services/vap_svc_mesh_ext.c @@ -1239,6 +1239,18 @@ int vap_svc_mesh_ext_update(vap_svc_t *svc, unsigned int radio_index, wifi_vap_i ext->is_started = true; } } + wifi_apps_mgr_t *apps_mgr = NULL; + wifi_app_t *uahf_app = NULL; + if (ctrl != NULL) { + apps_mgr = &ctrl->apps_mgr; + uahf_app = (wifi_app_t *)get_app_by_inst(apps_mgr, wifi_app_inst_uahf); + if (uahf_app != NULL) { + uahf_app->desc.update_fn(uahf_app); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] started the server\n", __func__, __LINE__); + } else { + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); + } + } if (tgt_vap_map) { free(tgt_vap_map); tgt_vap_map = NULL; diff --git a/source/core/wifi_ctrl_rbus_handlers.c b/source/core/wifi_ctrl_rbus_handlers.c index 084327ad8..0a476818f 100644 --- a/source/core/wifi_ctrl_rbus_handlers.c +++ b/source/core/wifi_ctrl_rbus_handlers.c @@ -149,7 +149,7 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t start_station_vaps(rf_status); wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : %d, enabled station vaps\n", __func__, __LINE__, ctrl->rf_status_down); - wifi_apps_mgr_t *apps_mgr = NULL; + /* wifi_apps_mgr_t *apps_mgr = NULL; wifi_app_t *uahf_app = NULL; if (ctrl != NULL) { apps_mgr = &ctrl->apps_mgr; @@ -160,7 +160,7 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t } else { wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); } - } + }*/ return rc; } From 6d048b7f0fcaff18d8a6543de7a2600c1d3fe101 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Sat, 22 Nov 2025 01:01:38 +0100 Subject: [PATCH 08/17] notify srv from publish_endpoint_enable and start_extender_vaps from worker thread --- source/apps/uahf/uahf.c | 7 ++++--- source/core/wifi_ctrl.h | 1 + source/core/wifi_ctrl_rbus_handlers.c | 28 +++++++++++++++------------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index e86d958cb..9e44990e4 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -71,10 +71,11 @@ wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 16\n", __ wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set psk for vap 24\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 24, call apply\n", __func__, __LINE__); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 24, call start ext vaps\n", __func__, __LINE__); - system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called apply ap settings\n", __func__, __LINE__); +// system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); + start_extender_vaps(); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called start extender vaps\n", __func__, __LINE__); return NULL; diff --git a/source/core/wifi_ctrl.h b/source/core/wifi_ctrl.h index 8c22807fb..4ac44feeb 100644 --- a/source/core/wifi_ctrl.h +++ b/source/core/wifi_ctrl.h @@ -322,6 +322,7 @@ void deinit_ctrl_monitor(wifi_ctrl_t *ctrl); bool is_db_consolidated(); bool is_db_backup_required(); bool is_devtype_pod(); +void start_extender_vaps(void); UINT getRadioIndexFromAp(UINT apIndex); UINT getPrivateApFromRadioIndex(UINT radioIndex); diff --git a/source/core/wifi_ctrl_rbus_handlers.c b/source/core/wifi_ctrl_rbus_handlers.c index 0a476818f..b8c5a5302 100644 --- a/source/core/wifi_ctrl_rbus_handlers.c +++ b/source/core/wifi_ctrl_rbus_handlers.c @@ -149,18 +149,6 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t start_station_vaps(rf_status); wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : %d, enabled station vaps\n", __func__, __LINE__, ctrl->rf_status_down); - /* wifi_apps_mgr_t *apps_mgr = NULL; - wifi_app_t *uahf_app = NULL; - if (ctrl != NULL) { - apps_mgr = &ctrl->apps_mgr; - uahf_app = (wifi_app_t *)get_app_by_inst(apps_mgr, wifi_app_inst_uahf); - if (uahf_app != NULL) { - uahf_app->desc.update_fn(uahf_app); - wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] started the server\n", __func__, __LINE__); - } else { - wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); - } - }*/ return rc; } @@ -905,6 +893,22 @@ int publish_endpoint_enable(void) } else { wifi_util_info_print(WIFI_CTRL, "%s:%d Endpoint Enable publish successful\n", __func__, __LINE__); } + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] about to start the server\n", __func__, __LINE__); + + wifi_apps_mgr_t *apps_mgr = NULL; + wifi_app_t *uahf_app = NULL; + if (ctrl != NULL) { + apps_mgr = &ctrl->apps_mgr; + uahf_app = (wifi_app_t *)get_app_by_inst(apps_mgr, wifi_app_inst_uahf); + if (uahf_app != NULL) { + uahf_app->desc.update_fn(uahf_app); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] started the server\n", __func__, __LINE__); + } else { + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); + } + } + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] exit!\n", __func__, __LINE__); + return RETURN_OK; } bus_error_t webconfig_set_subdoc(char *event_name, raw_data_t *p_data, bus_user_data_t *user_data) From 083e4fefc54f9434e5c493a5d38d8cd56d5b6f9a Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Sat, 22 Nov 2025 01:31:21 +0100 Subject: [PATCH 09/17] .... --- source/apps/uahf/uahf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index 9e44990e4..6c94d4d7e 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -73,7 +73,9 @@ wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set psk for vap 24 system(command_buffer); wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 24, call start ext vaps\n", __func__, __LINE__); -// system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); + system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); +wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : will be called start extender vaps\n", __func__, __LINE__); + start_extender_vaps(); wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called start extender vaps\n", __func__, __LINE__); From 78adf81e7324ce37859402d518046f2f5c25061c Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Thu, 27 Nov 2025 00:50:16 +0100 Subject: [PATCH 10/17] . --- source/apps/uahf/uahf.c | 42 ++++++++++++++----- source/apps/uahf/uahf.h | 1 + source/apps/uahf/uahf_server.c | 73 +++++++++++++++++++++++----------- 3 files changed, 83 insertions(+), 33 deletions(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index 6c94d4d7e..882a0cb5b 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -15,16 +15,19 @@ void* uahf_worker_task(void* arg) { wifi_app_t* app = (wifi_app_t*)arg; uahf_data_t* d = GET_UAHF(app); + wifi_util_error_print(WIFI_CTRL, "UAHF: starting server in detached thread\n"); + // 1. Run the server directly (BLOCKING) // This will sit here until the user submits the form and the loop breaks uahf_start_server(app); + wifi_util_error_print(WIFI_CTRL, "UAHF: server exited in detached thread\n"); // 2. Update State (Critical Section) - pthread_mutex_lock(&app->lock); + pthread_mutex_lock(&d->app_lock); d->worker_running = false; d->worker_done = true; // Signal main thread that data is in d->username/password - pthread_mutex_unlock(&app->lock); + pthread_mutex_unlock(&d->app_lock); wifi_util_error_print(WIFI_CTRL, "UAHF Result: User=%s, Pass=%s\n", d->username, d->password); @@ -85,26 +88,42 @@ wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called start extender vaps\n", _ int uahf_update(wifi_app_t *app) { uahf_data_t* d = GET_UAHF(app); + wifi_util_error_print(WIFI_APPS, "%s:%d: Init uahf-update\n", __func__, __LINE__); // --- Trigger Server --- if (!d->worker_running && !d->worker_done) { - pthread_mutex_lock(&app->lock); - pthread_mutex_lock(&app->lock); + pthread_mutex_lock(&d->app_lock); // Clear old data just in case memset(d->username, 0, sizeof(d->username)); memset(d->password, 0, sizeof(d->password)); - d->worker_running = true; + if (!d->worker_running) { + d->worker_running = true; - if (pthread_create(&d->worker_tid, NULL, uahf_worker_task, app) == 0) { - pthread_detach(d->worker_tid); - } else { - d->worker_running = false; + // --- SPAWN THREAD (NON-BLOCKING) --- + // We create a separate thread to handle the blocking server. + // pthread_create returns immediately. + + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, 128 * 1024); + wifi_util_error_print(WIFI_APPS, "%s:%d: uahf:about to spawn a thread with server\n", __func__, __LINE__); + + if (pthread_create(&d->worker_tid, &attr, uahf_worker_task, app) == 0) { + pthread_detach(d->worker_tid); // Fire and forget + wifi_util_error_print(WIFI_APPS, "%s:%d: uahf: started thread with server\n", __func__, __LINE__); + + } else { + d->worker_running = false; + } + pthread_attr_destroy(&attr); } - pthread_mutex_unlock(&app->lock); + pthread_mutex_unlock(&d->app_lock); } + wifi_util_error_print(WIFI_APPS, "%s:%d: uahf spawned a thread succ\n", __func__, __LINE__); + // --- Process Results -- // dead cpde for now if (d->worker_done) { @@ -120,6 +139,7 @@ int uahf_update(wifi_app_t *app) { } pthread_mutex_unlock(&app->lock); } +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf: exit\n", __func__, __LINE__); return RETURN_OK; } @@ -128,6 +148,8 @@ int uahf_init(wifi_app_t *app, unsigned int create_flag) { memset(&app->data.u.uahf_data, 0, sizeof(uahf_data_t)); + pthread_mutex_init(&app->data.u.uahf_data.lock, NULL); + if (app_init(app, create_flag) != 0) { return RETURN_ERR; } diff --git a/source/apps/uahf/uahf.h b/source/apps/uahf/uahf.h index 3da387b8d..1e0d1e733 100644 --- a/source/apps/uahf/uahf.h +++ b/source/apps/uahf/uahf.h @@ -7,6 +7,7 @@ typedef struct { void *data; // Thread Management + pthread_mutex_t app_lock; pthread_t worker_tid; bool worker_running; bool worker_done; diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c index 4de6eb9b7..49e40161c 100644 --- a/source/apps/uahf/uahf_server.c +++ b/source/apps/uahf/uahf_server.c @@ -79,30 +79,49 @@ void send_html_page(int client_fd, int showThanks) } int uahf_start_server(wifi_app_t *app) { - uahf_data_t *d = (uahf_data_t *)GET_UAHF(app); // Access your specific data + uahf_data_t *d = /*(uahf_data_t *)*/GET_UAHF(app); // Access your specific data int server_fd, client_fd; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); - char buffer[BUFFER_SIZE]; - char username_local[200] = {0}, password_local[200] = {0}; - char decoded[400]; - - server_fd = socket(AF_INET, SOCK_STREAM, 0); - if (server_fd == -1) { - perror("socket failed"); - exit(1); + char *buffer = NULL; // Use heap to save stack + char decoded[200]; + char username_local[200] = {0}; + char password_local[200] = {0}; + + // Allocate buffer on heap to prevent stack overflow in small threads + buffer = (char*)malloc(4096); + if (!buffer) { + wifi_util_error_print(WIFI_APPS, "UAHF: OOM for buffer\n"); + return -1; } - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = INADDR_ANY; - addr.sin_port = htons(PORT); - if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - perror("bind failed"); - exit(1); + // --- Socket Setup --- + if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0) { + // perror("socket failed"); + free(buffer); + return -1; + } +//added, might not be needed + // Use SO_REUSEADDR only + if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))) { + close(server_fd); + free(buffer); + return -1; + } +//added, might not be needed + address.sin_family = AF_INET; + address.sin_addr.s_addr = INADDR_ANY; + address.sin_port = htons(8080); + + if (bind(server_fd, (struct sockaddr *)&address, sizeof(address)) < 0) { + wifi_util_error_print(WIFI_APPS, "UAHF: Bind failed. Check Port 8080 usage.\n"); + close(server_fd); + free(buffer); + return -1; } listen(server_fd, 3); - fprintf(stderr,"Server running on port %d...\n", PORT); + wifi_util_info_print(WIFI_APPS, "UAHF: Server started on port %d...\n", PORT); while (1) { client_fd = accept(server_fd, (struct sockaddr *)&addr, &addrlen); @@ -122,8 +141,11 @@ int uahf_start_server(wifi_app_t *app) { showThanks = 1; send_html_page(client_fd, showThanks); - if (showThanks) - break; + // --- Exit Condition --- + if (strlen(username_local) > 0) { + close(client_fd); + break; + } } // ---- POST Request ---- @@ -147,9 +169,13 @@ int uahf_start_server(wifi_app_t *app) { url_decode(password_local, decoded); strcpy(password_local, decoded); - strncpy(d->username, username_local, 100); - strncpy(d->password, password_local, 100); - fprintf(stderr,"User submitted: %s / %s\n", username_local, password_local); + wifi_util_info_print(WIFI_APPS, "Captured: %s / %s\n", username_local, password_local); + + // --- CRITICAL SECTION: Save Data --- + pthread_mutex_lock(&app->lock); + strncpy(d->username, username_local, sizeof(d->username)-1); + strncpy(d->password, password_local, sizeof(d->password)-1); + pthread_mutex_unlock(&app->lock); } fprintf(stderr, "POST received - redirecting with thank you note...\n"); @@ -163,9 +189,10 @@ int uahf_start_server(wifi_app_t *app) { write(client_fd, redirect, strlen(redirect)); } - - close(client_fd); } + close(server_fd); + free(buffer); + /* char command_buffer[BUFFER_SIZE]; int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", username); From ad20992710c386ce2b28505da9c89ceb5b16821b Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Thu, 27 Nov 2025 02:42:04 +0100 Subject: [PATCH 11/17] . --- source/apps/uahf/uahf.c | 6 +++--- source/apps/uahf/uahf_server.c | 20 ++++++-------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index 882a0cb5b..9aa21e7a2 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -127,7 +127,7 @@ int uahf_update(wifi_app_t *app) { // --- Process Results -- // dead cpde for now if (d->worker_done) { - pthread_mutex_lock(&app->lock); + pthread_mutex_lock(&d->app_lock); if (d->worker_done) { // SUCCESS: Data is now available directly in the struct @@ -137,7 +137,7 @@ int uahf_update(wifi_app_t *app) { d->worker_done = false; } - pthread_mutex_unlock(&app->lock); + pthread_mutex_unlock(&d->app_lock); } wifi_util_error_print(WIFI_APPS, "%s:%d: uahf: exit\n", __func__, __LINE__); @@ -148,7 +148,7 @@ int uahf_init(wifi_app_t *app, unsigned int create_flag) { memset(&app->data.u.uahf_data, 0, sizeof(uahf_data_t)); - pthread_mutex_init(&app->data.u.uahf_data.lock, NULL); + pthread_mutex_init(&app->data.u.uahf_data.app_lock, NULL); if (app_init(app, create_flag) != 0) { return RETURN_ERR; diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c index 49e40161c..a9689c772 100644 --- a/source/apps/uahf/uahf_server.c +++ b/source/apps/uahf/uahf_server.c @@ -101,19 +101,11 @@ int uahf_start_server(wifi_app_t *app) { free(buffer); return -1; } -//added, might not be needed - // Use SO_REUSEADDR only - if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))) { - close(server_fd); - free(buffer); - return -1; - } -//added, might not be needed - address.sin_family = AF_INET; - address.sin_addr.s_addr = INADDR_ANY; - address.sin_port = htons(8080); - if (bind(server_fd, (struct sockaddr *)&address, sizeof(address)) < 0) { + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = INADDR_ANY; + addr.sin_port = htons(PORT); + if (bind(server_fd, (struct sockaddr *)&addr, addrlen) < 0) { wifi_util_error_print(WIFI_APPS, "UAHF: Bind failed. Check Port 8080 usage.\n"); close(server_fd); free(buffer); @@ -172,10 +164,10 @@ int uahf_start_server(wifi_app_t *app) { wifi_util_info_print(WIFI_APPS, "Captured: %s / %s\n", username_local, password_local); // --- CRITICAL SECTION: Save Data --- - pthread_mutex_lock(&app->lock); + pthread_mutex_lock(&d->app_lock); strncpy(d->username, username_local, sizeof(d->username)-1); strncpy(d->password, password_local, sizeof(d->password)-1); - pthread_mutex_unlock(&app->lock); + pthread_mutex_unlock(&d->app_lock); } fprintf(stderr, "POST received - redirecting with thank you note...\n"); From ffa4a25d7ca959db7dcd9cb7ea641de8c66083ef Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Fri, 28 Nov 2025 00:52:20 +0100 Subject: [PATCH 12/17] .. --- source/apps/uahf/uahf_server.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c index a9689c772..de6b2ec65 100644 --- a/source/apps/uahf/uahf_server.c +++ b/source/apps/uahf/uahf_server.c @@ -87,6 +87,7 @@ int uahf_start_server(wifi_app_t *app) { char decoded[200]; char username_local[200] = {0}; char password_local[200] = {0}; + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); // Allocate buffer on heap to prevent stack overflow in small threads buffer = (char*)malloc(4096); @@ -96,17 +97,18 @@ int uahf_start_server(wifi_app_t *app) { } // --- Socket Setup --- - if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0) { - // perror("socket failed"); + if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + wifi_util_error_print(WIFI_APPS, "%d: UAHF: SOcket failed. .\n", __LINE__); free(buffer); return -1; } + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_port = htons(PORT); - if (bind(server_fd, (struct sockaddr *)&addr, addrlen) < 0) { - wifi_util_error_print(WIFI_APPS, "UAHF: Bind failed. Check Port 8080 usage.\n"); + if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + wifi_util_error_print(WIFI_APPS, "UAHF: Bind failed. Check Port %d usage.\n", PORT); close(server_fd); free(buffer); return -1; @@ -114,6 +116,7 @@ int uahf_start_server(wifi_app_t *app) { listen(server_fd, 3); wifi_util_info_print(WIFI_APPS, "UAHF: Server started on port %d...\n", PORT); +wifi_util_info_print(WIFI_APPS, "UAHF: strname length %d...\n", strlen(username_local)); while (1) { client_fd = accept(server_fd, (struct sockaddr *)&addr, &addrlen); @@ -121,27 +124,32 @@ int uahf_start_server(wifi_app_t *app) { perror("accept"); continue; } - + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); memset(buffer, 0, BUFFER_SIZE); read(client_fd, buffer, BUFFER_SIZE); + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); // ---- GET Request ---- if (strncmp(buffer, "GET", 3) == 0) { int showThanks = 0; + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); if (strstr(buffer, "thanks=1")) showThanks = 1; + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); send_html_page(client_fd, showThanks); // --- Exit Condition --- - if (strlen(username_local) > 0) { + if (strlen(username_local) > 0 && showThanks) { close(client_fd); break; } - } + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + } // ---- POST Request ---- else if (strncmp(buffer, "POST", 4) == 0) { + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); // Extract POST body (optional) char *body = strstr(buffer, "\r\n\r\n"); @@ -150,10 +158,12 @@ int uahf_start_server(wifi_app_t *app) { char *u = strstr(body, "username="); char *p = strstr(body, "password="); + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); if (u && p) { sscanf(u, "username=%199[^&]", username_local); sscanf(p, "password=%199[^&]", password_local); + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); url_decode(username_local, decoded); strcpy(username_local, decoded); @@ -170,7 +180,7 @@ int uahf_start_server(wifi_app_t *app) { pthread_mutex_unlock(&d->app_lock); } - fprintf(stderr, "POST received - redirecting with thank you note...\n"); + wifi_util_info_print(WIFI_APPS, "uahf:POST received - redirecting with thank you note...\n"); // Redirect to same page with thank-you flag const char *redirect = @@ -178,10 +188,13 @@ int uahf_start_server(wifi_app_t *app) { "Location: /?thanks=1\r\n" "Content-Length: 0\r\n" "\r\n"; + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); write(client_fd, redirect, strlen(redirect)); } } + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + close(server_fd); free(buffer); From efbd64e61799e48a9cc2ce49b02c0082a985b068 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Fri, 5 Dec 2025 18:17:17 +0100 Subject: [PATCH 13/17] Dec4 EOD update --- source/apps/uahf/uahf.c | 53 ++++--- source/apps/uahf/uahf_server.c | 70 ++++++--- source/core/services/vap_svc.h | 6 +- source/core/services/vap_svc_mesh_ext.c | 49 +++++-- source/core/wifi_ctrl.c | 10 +- source/core/wifi_ctrl.h | 2 +- source/core/wifi_ctrl_queue_handlers.c | 8 + source/core/wifi_ctrl_rbus_handlers.c | 24 ++- source/core/wifi_ctrl_webconfig.c | 186 +++++++++++++++++++++++- source/dml/tr_181/ml/cosa_wifi_dml.c | 10 +- source/utils/scheduler.c | 15 +- 11 files changed, 351 insertions(+), 82 deletions(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index 9aa21e7a2..f98385b49 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -15,12 +15,12 @@ void* uahf_worker_task(void* arg) { wifi_app_t* app = (wifi_app_t*)arg; uahf_data_t* d = GET_UAHF(app); - wifi_util_error_print(WIFI_CTRL, "UAHF: starting server in detached thread\n"); + wifi_util_error_print(WIFI_APPS, "UAHF: starting server in detached thread\n"); // 1. Run the server directly (BLOCKING) // This will sit here until the user submits the form and the loop breaks uahf_start_server(app); - wifi_util_error_print(WIFI_CTRL, "UAHF: server exited in detached thread\n"); + wifi_util_error_print(WIFI_APPS, "UAHF: server exited from detached thread\n"); // 2. Update State (Critical Section) pthread_mutex_lock(&d->app_lock); @@ -35,53 +35,58 @@ void* uahf_worker_task(void* arg) { // Pass to AppMgr or other logic // process_login(d->username, d->password); #define BUFFER_SIZE 4096 - char command_buffer[BUFFER_SIZE]; + /*char command_buffer[BUFFER_SIZE]; int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", d->username); if (len == 0) printf("have to use this somewhere to disable -Wall error"); - wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set ssid for vap 15\n", __func__, __LINE__); + wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 15\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set ssid for vap 15\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 15\n", __func__, __LINE__); len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.16.SSID string %s", d->username); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set ssid for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 16\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set ssid for vap 16\n", __func__, __LINE__); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set ssid for vap 24\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set ssid for vap 24\n", __func__, __LINE__); len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.24.SSID string %s", d->username); system(command_buffer); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set ssid for vap 24\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set ssid for vap 24\n", __func__, __LINE__); len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.AccessPoint.15.Security.KeyPassphrase string %s", d->password); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set psk for vap 15\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set psk for vap 15\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 15\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 15\n", __func__, __LINE__); len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.AccessPoint.16.Security.KeyPassphrase string %s", d->password); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set psk for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : will call set psk for vap 16, with %s \n", __func__, __LINE__, d->password); system(command_buffer); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 16\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: cmd: %s\n", __func__, __LINE__, command_buffer); len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.AccessPoint.24.Security.KeyPassphrase string %s", d->password); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : about to call set psk for vap 24\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : about to call set psk for vap 24\n", __func__, __LINE__); system(command_buffer); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called set psk for vap 24, call start ext vaps\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 24, call start ext vaps\n", __func__, __LINE__); - system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : will be called start extender vaps\n", __func__, __LINE__); + system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); */ +//wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : will call start extender vaps\n", __func__, __LINE__); - start_extender_vaps(); -wifi_util_error_print(WIFI_CTRL, "%s:%d: uahf : called start extender vaps\n", __func__, __LINE__); + // start_extender_vaps(); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called start extender vaps\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: will called start uahf vaps\n", __func__, __LINE__); + +start_uahf_vaps(TRUE, d->username, d->password); +wifi_util_error_print(WIFI_APPS, "%s:%d: called start uahf vaps\n", __func__, __LINE__); return NULL; } @@ -92,6 +97,8 @@ int uahf_update(wifi_app_t *app) { // --- Trigger Server --- if (!d->worker_running && !d->worker_done) { + wifi_util_error_print(WIFI_APPS, "%s:%d: wILL try to create thread\n", __func__, __LINE__); + pthread_mutex_lock(&d->app_lock); // Clear old data just in case @@ -108,7 +115,7 @@ int uahf_update(wifi_app_t *app) { pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 * 1024); - wifi_util_error_print(WIFI_APPS, "%s:%d: uahf:about to spawn a thread with server\n", __func__, __LINE__); + wifi_util_error_print(WIFI_APPS, "%s:%d: uahf:about to spawn a thread with server\n", __func__, __LINE__); if (pthread_create(&d->worker_tid, &attr, uahf_worker_task, app) == 0) { pthread_detach(d->worker_tid); // Fire and forget @@ -122,7 +129,7 @@ int uahf_update(wifi_app_t *app) { pthread_mutex_unlock(&d->app_lock); } - wifi_util_error_print(WIFI_APPS, "%s:%d: uahf spawned a thread succ\n", __func__, __LINE__); +// wifi_util_error_print(WIFI_APPS, "%s:%d: uahf after spawning a thread block\n", __func__, __LINE__); // --- Process Results -- // dead cpde for now @@ -135,11 +142,11 @@ int uahf_update(wifi_app_t *app) { d->username, d->password); - d->worker_done = false; + d->worker_done = true; //for now we leave it here,so that it isn't restarted several times. } pthread_mutex_unlock(&d->app_lock); } -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf: exit\n", __func__, __LINE__); +//wifi_util_error_print(WIFI_APPS, "%s:%d: uahf: exit\n", __func__, __LINE__); return RETURN_OK; } diff --git a/source/apps/uahf/uahf_server.c b/source/apps/uahf/uahf_server.c index de6b2ec65..c1afd6e26 100644 --- a/source/apps/uahf/uahf_server.c +++ b/source/apps/uahf/uahf_server.c @@ -65,6 +65,7 @@ void send_html_page(int client_fd, int showThanks) strcat(page, "
Thank you for providing the details!
"); } + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); strcat(page, "

Please enter your login details

" @@ -74,8 +75,11 @@ void send_html_page(int client_fd, int showThanks) "" "" ""); + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); write(client_fd, page, strlen(page)); + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + } int uahf_start_server(wifi_app_t *app) { @@ -83,23 +87,25 @@ int uahf_start_server(wifi_app_t *app) { int server_fd, client_fd; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); - char *buffer = NULL; // Use heap to save stack + //char *buffer = NULL; // Use heap to save stack char decoded[200]; char username_local[200] = {0}; char password_local[200] = {0}; wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); // Allocate buffer on heap to prevent stack overflow in small threads - buffer = (char*)malloc(4096); - if (!buffer) { + //buffer = (char*)malloc(BUFFER_SIZE); + char buffer[BUFFER_SIZE]; + + /* if (!buffer) { wifi_util_error_print(WIFI_APPS, "UAHF: OOM for buffer\n"); return -1; - } + }*/ // --- Socket Setup --- if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { wifi_util_error_print(WIFI_APPS, "%d: UAHF: SOcket failed. .\n", __LINE__); - free(buffer); + // free(buffer); return -1; } wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); @@ -110,7 +116,7 @@ int uahf_start_server(wifi_app_t *app) { if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { wifi_util_error_print(WIFI_APPS, "UAHF: Bind failed. Check Port %d usage.\n", PORT); close(server_fd); - free(buffer); + // free(buffer); return -1; } @@ -121,35 +127,50 @@ wifi_util_info_print(WIFI_APPS, "UAHF: strname length %d...\n", strlen(username_ while (1) { client_fd = accept(server_fd, (struct sockaddr *)&addr, &addrlen); if (client_fd < 0) { - perror("accept"); + wifi_util_info_print(WIFI_APPS, "UAHF: Server clientfd <0, skip loop! %d...\n", __LINE__); continue; } - wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + + // --- FIX: SET READ TIMEOUT --- + // Prevents browser pre-connections (which send no data) from hanging the server + struct timeval tv; + tv.tv_sec = 2; // 2 Second timeout + tv.tv_usec = 0; + setsockopt(client_fd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof tv); + memset(buffer, 0, BUFFER_SIZE); - read(client_fd, buffer, BUFFER_SIZE); - wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + + // --- FIX: CHECK READ RETURN VALUE --- + // If bytes <= 0, it means timeout or disconnect. Don't process. + ssize_t bytes_read = read(client_fd, buffer, BUFFER_SIZE - 1); + +// read(client_fd, buffer, BUFFER_SIZE); + wifi_util_info_print(WIFI_APPS, "UAHF: Server read bytes %d , at line %d...\n", bytes_read, __LINE__); + if (bytes_read > 0) { + buffer[bytes_read] = '\0'; // Safety null terminate // ---- GET Request ---- if (strncmp(buffer, "GET", 3) == 0) { int showThanks = 0; - wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + wifi_util_info_print(WIFI_APPS, "UAHF: Serving GET %d...\n", __LINE__); - if (strstr(buffer, "thanks=1")) + if (strstr(buffer, "thanks=1")) { showThanks = 1; - wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); - + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d..., show thanks %d\n", __LINE__, showThanks); + } send_html_page(client_fd, showThanks); // --- Exit Condition --- if (strlen(username_local) > 0 && showThanks) { + wifi_util_info_print(WIFI_APPS, "UAHF: Exit condition met, break from loop. Server %d...\n", __LINE__); close(client_fd); break; } - wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); - + wifi_util_info_print(WIFI_APPS, "UAHF: Server ending GET %d...\n", __LINE__); } // ---- POST Request ---- else if (strncmp(buffer, "POST", 4) == 0) { - wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + wifi_util_info_print(WIFI_APPS, "UAHF: Server Handling POST %d...\n", __LINE__); // Extract POST body (optional) char *body = strstr(buffer, "\r\n\r\n"); @@ -178,6 +199,8 @@ wifi_util_info_print(WIFI_APPS, "UAHF: strname length %d...\n", strlen(username_ strncpy(d->username, username_local, sizeof(d->username)-1); strncpy(d->password, password_local, sizeof(d->password)-1); pthread_mutex_unlock(&d->app_lock); + wifi_util_info_print(WIFI_APPS, "Successfully updated thread struct\n"); + } wifi_util_info_print(WIFI_APPS, "uahf:POST received - redirecting with thank you note...\n"); @@ -188,15 +211,20 @@ wifi_util_info_print(WIFI_APPS, "UAHF: strname length %d...\n", strlen(username_ "Location: /?thanks=1\r\n" "Content-Length: 0\r\n" "\r\n"; - wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); + wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); write(client_fd, redirect, strlen(redirect)); } + } else { + wifi_util_info_print(WIFI_APPS, "UAHF: Read timeout or empty. Dropping connection.\n"); + } + close(client_fd); + wifi_util_info_print(WIFI_APPS, "UAHF: Closed client_fd. Looping... %d...\n", __LINE__); } - wifi_util_info_print(WIFI_APPS, "UAHF: Server %d...\n", __LINE__); - + + wifi_util_info_print(WIFI_APPS, "UAHF: Server shutdown %d...\n", __LINE__); close(server_fd); - free(buffer); + // free(buffer); /* char command_buffer[BUFFER_SIZE]; diff --git a/source/core/services/vap_svc.h b/source/core/services/vap_svc.h index acc963641..9dd28a474 100644 --- a/source/core/services/vap_svc.h +++ b/source/core/services/vap_svc.h @@ -61,10 +61,10 @@ typedef bool (* vap_svc_is_my_fn_t)(unsigned int vap_index); #define MAX_SCAN_RESULT_WAIT 2 // max connection algoritham timeout 4 minutes #define MAX_CONNECTION_ALGO_TIMEOUT 4 * 60 -#define EXT_CONNECT_ALGO_PROCESSOR_INTERVAL 1000 +#define EXT_CONNECT_ALGO_PROCESSOR_INTERVAL 20000 -#define EXT_SCAN_RESULT_TIMEOUT 4000 -#define EXT_SCAN_RESULT_WAIT_TIMEOUT 4000 +#define EXT_SCAN_RESULT_TIMEOUT 9000 +#define EXT_SCAN_RESULT_WAIT_TIMEOUT 9000 #define EXT_CONN_STATUS_IND_TIMEOUT 5000 #define EXT_IGNITE_CONN_STATUS_IND_TIMEOUT 10000 #ifndef EXT_CSA_WAIT_TIMEOUT diff --git a/source/core/services/vap_svc_mesh_ext.c b/source/core/services/vap_svc_mesh_ext.c index 2281c4454..f8a4213d9 100644 --- a/source/core/services/vap_svc_mesh_ext.c +++ b/source/core/services/vap_svc_mesh_ext.c @@ -261,7 +261,12 @@ static void schedule_connect_sm(vap_svc_t *svc) } scheduler_add_timer_task(ctrl->sched, FALSE, &ext->ext_connect_algo_processor_id, - process_ext_connect_algorithm, svc, EXT_CONNECT_ALGO_PROCESSOR_INTERVAL, 1, FALSE); + process_ext_connect_algorithm, svc, EXT_CONNECT_ALGO_PROCESSOR_INTERVAL, 1, TRUE); + +/*int scheduler_add_timer_task(struct scheduler *sched, bool high_prio, int *id, + int (*cb)(void *arg), void *arg, unsigned int interval_ms, + unsigned int repetitions, bool start_immediately) +*/ } void ext_incomplete_scan_list(vap_svc_t *svc) @@ -271,6 +276,8 @@ void ext_incomplete_scan_list(vap_svc_t *svc) ext->wait_scan_result++; if (ext->wait_scan_result > MAX_SCAN_RESULT_WAIT) { ext->wait_scan_result = 0; + wifi_util_info_print(WIFI_CTRL, "%s:%d scan result inscomplete!!\n", __func__, __LINE__); + ext_set_conn_state(ext, connection_state_disconnected_scan_list_all, __func__, __LINE__); ext->scanned_radios = 0; schedule_connect_sm(svc); @@ -564,12 +571,12 @@ int process_udhcp_ip_check(vap_svc_t *svc) void cancel_scan_result_timer(wifi_ctrl_t *l_ctrl, vap_svc_ext_t *l_ext) { if (l_ext->ext_scan_result_timeout_handler_id != 0) { - wifi_util_dbg_print(WIFI_CTRL,"%s:%d - cancel wifi start scan timer\r\n", __func__, __LINE__); + wifi_util_info_print(WIFI_CTRL,"%s:%d - cancel wifi start scan timer\r\n", __func__, __LINE__); scheduler_cancel_timer_task(l_ctrl->sched, l_ext->ext_scan_result_timeout_handler_id); l_ext->ext_scan_result_timeout_handler_id = 0; } if (l_ext->ext_connected_scan_result_timeout_handler_id != 0) { - wifi_util_dbg_print(WIFI_CTRL,"%s:%d - cancel wifi start scan timer\r\n", __func__, __LINE__); + wifi_util_info_print(WIFI_CTRL,"%s:%d - cancel wifi start scan timer\r\n", __func__, __LINE__); scheduler_cancel_timer_task(l_ctrl->sched, l_ext->ext_connected_scan_result_timeout_handler_id); l_ext->ext_connected_scan_result_timeout_handler_id = 0; } @@ -592,13 +599,13 @@ void ext_start_scan(vap_svc_t *svc) ext = &svc->u.ext; if (ext->conn_state != connection_state_disconnected_scan_list_none) { - wifi_util_dbg_print(WIFI_CTRL,"%s:%d wifi_scan completed, current state: %s\r\n",__func__, + wifi_util_info_print(WIFI_CTRL,"%s:%d wifi_scan completed, current state: %s\r\n",__func__, __LINE__, ext_conn_state_to_str(ext->conn_state)); return; } cancel_scan_result_timer(ctrl, ext); - wifi_util_dbg_print(WIFI_CTRL,"%s:%d Enter......\r\n",__func__, __LINE__); + wifi_util_info_print(WIFI_CTRL,"%s:%d Enter......\r\n",__func__, __LINE__); // first free up scan list if (ext->candidates_list.scan_list != NULL) { ext->candidates_list.scan_count = 0; @@ -626,6 +633,8 @@ void ext_start_scan(vap_svc_t *svc) if (get_allowed_channels(radio_oper_param->band, &mgr->hal_cap.wifi_prop.radiocap[radio_index], channels_list, &num_channels, radio_oper_param->DfsEnabled) != RETURN_OK) { + wifi_util_info_print(WIFI_CTRL, "%s:%d ---- \n", __func__, __LINE__); + continue; } (void)memcpy(channels.channels_list, channels_list, @@ -634,14 +643,17 @@ void ext_start_scan(vap_svc_t *svc) if (get_sta_ssid_from_radio_config_by_radio_index(radio_index, ssid)) { // Didn't find a STA for this radio index + wifi_util_info_print(WIFI_CTRL, "%s:%d ---- \n", __func__, __LINE__); + continue; } if (strlen(ssid) == 0) { + wifi_util_info_print(WIFI_CTRL, "%s:%d ---- \n", __func__, __LINE__); // SSID is wildcard SSID continue; } - wifi_util_dbg_print(WIFI_CTRL, "%s:%d start Scan on radio index %u\n", __func__, __LINE__, + wifi_util_info_print(WIFI_CTRL, "%s:%d start Scan on radio index %u\n", __func__, __LINE__, radio_index); wifi_hal_startScan(radio_index, mode, dwell_time, channels.num_channels, channels.channels_list); @@ -694,7 +706,7 @@ void ext_connected_scan(vap_svc_t *svc) wifi_util_dbg_print(WIFI_CTRL,"%s:%d NULL pointer\n", __func__, __LINE__); return; } - wifi_util_dbg_print(WIFI_CTRL,"%s:%d Enter \n", __func__, __LINE__); + wifi_util_info_print(WIFI_CTRL,"%s:%d Enter \n", __func__, __LINE__); vap_svc_ext_t *ext; wifi_ctrl_t *ctrl; @@ -713,7 +725,7 @@ void ext_connected_scan(vap_svc_t *svc) ext->candidates_list.scan_list = NULL; } - wifi_util_dbg_print(WIFI_CTRL,"%s:%d start Scan on radio index %d channel %d\n", __func__, __LINE__, radio_index, ext->go_to_channel); + wifi_util_info_print(WIFI_CTRL,"%s:%d start Scan on radio index %d channel %d\n", __func__, __LINE__, radio_index, ext->go_to_channel); wifi_hal_startScan(radio_index, WIFI_RADIO_SCAN_MODE_OFFCHAN, dwell_time, 1, &ext->go_to_channel); } @@ -830,6 +842,8 @@ void ext_try_connecting(vap_svc_t *svc) ctrl = svc->ctrl; ext = &svc->u.ext; + wifi_util_info_print(WIFI_CTRL, "%s:%d Enter!\n", __func__, __LINE__); + if (ext->conn_state == connection_state_connection_to_nb_in_progress) { candidate = &ext->new_bss; @@ -841,6 +855,7 @@ void ext_try_connecting(vap_svc_t *svc) candidate->conn_retry_attempt++; } else if (ext->conn_state == connection_state_connection_in_progress) { candidate = ext->candidates_list.scan_list; + wifi_util_info_print(WIFI_CTRL, "%s:%d ---- \n", __func__, __LINE__); for (i = 0; i < ext->candidates_list.scan_count; i++) { if (temp == NULL && (candidate->conn_attempt == connection_attempt_wait) && @@ -861,6 +876,8 @@ void ext_try_connecting(vap_svc_t *svc) candidate++; } if (new_bss || last_connected_bss || temp) { + wifi_util_info_print(WIFI_CTRL, "%s:%d ---- \n", __func__, __LINE__); + if (new_bss) { candidate = new_bss; candidate->conn_retry_attempt = 1; @@ -878,7 +895,7 @@ void ext_try_connecting(vap_svc_t *svc) found_at_least_one_candidate = true; } } else { - wifi_util_dbg_print(WIFI_CTRL, "%s:%d: assert - conn_state : %s\n", __func__, __LINE__, + wifi_util_info_print(WIFI_CTRL, "%s:%d: assert - conn_state : %s\n", __func__, __LINE__, ext_conn_state_to_str(ext->conn_state)); // should not come here in any states other than connection_state_connection_in_progress assert((ext->conn_state != connection_state_connection_in_progress) || @@ -931,7 +948,7 @@ int process_ext_connect_algorithm(vap_svc_t *svc) vap_svc_ext_t *ext; ext = &svc->u.ext; - wifi_util_dbg_print(WIFI_CTRL, "%s:%d process connection state: %s\r\n", __func__, __LINE__, + wifi_util_info_print(WIFI_CTRL, "%s:%d process connection state: %s\r\n", __func__, __LINE__, ext_conn_state_to_str(ext->conn_state)); ext->ext_connect_algo_processor_id = 0; @@ -1102,6 +1119,7 @@ static int process_ext_webconfig_set_data_sta_bssid(vap_svc_t *svc, void *arg) candidate = &ext->new_bss; uint8_mac_to_string_mac(vap_info->u.sta_info.bssid, bssid_str); + wifi_util_info_print(WIFI_CTRL, "%s:%d enter \n", __func__, __LINE__); // Support only connected/wait_for_csa/connected_scan_list -> nb_in_progress state change if (ext->conn_state != connection_state_connected && @@ -1239,7 +1257,7 @@ int vap_svc_mesh_ext_update(vap_svc_t *svc, unsigned int radio_index, wifi_vap_i ext->is_started = true; } } - wifi_apps_mgr_t *apps_mgr = NULL; + /* wifi_apps_mgr_t *apps_mgr = NULL; wifi_app_t *uahf_app = NULL; if (ctrl != NULL) { apps_mgr = &ctrl->apps_mgr; @@ -1250,7 +1268,7 @@ int vap_svc_mesh_ext_update(vap_svc_t *svc, unsigned int radio_index, wifi_vap_i } else { wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); } - } + } */ if (tgt_vap_map) { free(tgt_vap_map); tgt_vap_map = NULL; @@ -1264,6 +1282,7 @@ int process_ext_webconfig_set_data(vap_svc_t *svc, void *arg) bss_candidate_t *candidate; vap_svc_ext_t *ext = &svc->u.ext; unsigned int connected_radio_index = 0; + wifi_util_info_print(WIFI_CTRL, "%s:%d enter \n", __func__, __LINE__); if (radio_oper_param == NULL) { wifi_util_dbg_print(WIFI_CTRL,"%s:%d NULL Pointer\n", __func__, __LINE__); @@ -1346,7 +1365,7 @@ static void process_ext_trigger_disconnection(vap_svc_t *svc, void *arg) int process_ext_exec_timeout(vap_svc_t *svc, void *arg) { - wifi_util_dbg_print(WIFI_CTRL, "%s:%d exec timeout\n", __func__, __LINE__); + wifi_util_error_print(WIFI_CTRL, "%s:%d exec timeout\n", __func__, __LINE__); schedule_connect_sm(svc); @@ -1360,7 +1379,7 @@ int scan_result_wait_timeout(vap_svc_t *svc) ext->ext_scan_result_wait_timeout_handler_id = 0; if (ext->conn_state == connection_state_disconnected_scan_list_in_progress) { - wifi_util_dbg_print(WIFI_CTRL,"%s:%d - received only %u radio scan results\r\n", __func__, + wifi_util_error_print(WIFI_CTRL,"%s:%d - received only %u radio scan results\r\n", __func__, __LINE__, ext->scanned_radios); ext_set_conn_state(ext, connection_state_disconnected_scan_list_all, __func__, __LINE__); @@ -1401,7 +1420,7 @@ void process_ext_connected_scan_results(vap_svc_t *svc, void *arg) } if ((num == 0) || (bss == NULL)) { - wifi_util_dbg_print(WIFI_CTRL, "%s:%d No AP in the go to channel \n", __func__, __LINE__); + wifi_util_error_print(WIFI_CTRL, "%s:%d No AP in the go to channel \n", __func__, __LINE__); ext_set_conn_state(ext, connection_state_connected, __func__, __LINE__); schedule_connect_sm(svc); return; diff --git a/source/core/wifi_ctrl.c b/source/core/wifi_ctrl.c index 4b180abac..1709f664c 100644 --- a/source/core/wifi_ctrl.c +++ b/source/core/wifi_ctrl.c @@ -283,8 +283,9 @@ void sta_selfheal_handing(wifi_ctrl_t *ctrl, vap_svc_t *l_svc) bool is_sta_enabled(void) { wifi_ctrl_t *ctrl = (wifi_ctrl_t *)get_wifictrl_obj(); - wifi_util_error_print(WIFI_CTRL,"[%s:%d] device mode:%d active_gw_check:%d and rf_status_down=%d\r\n", - __func__, __LINE__, ctrl->network_mode, ctrl->active_gw_check, ctrl->rf_status_down); + wifi_util_error_print(WIFI_CTRL,"[%s:%d] dev mode:%d active_gw_ck:%d and rf_status_down=%d,ethbhaul:%d\r\n", + __func__, __LINE__, ctrl->network_mode, ctrl->active_gw_check, ctrl->rf_status_down, ctrl->eth_bh_status); + return ((ctrl->network_mode == rdk_dev_mode_type_ext || ctrl->network_mode == rdk_dev_mode_type_em_node || ctrl->active_gw_check == true || ctrl->rf_status_down == true ) && ctrl->eth_bh_status == false); @@ -1061,6 +1062,7 @@ int start_wifi_health_monitor_thread(void) int scan_results_callback(int radio_index, wifi_bss_info_t **bss, unsigned int *num) { scan_results_t *res; + wifi_util_dbg_print(WIFI_CTRL,"%s %d Scan resCB, init\n", __func__, __LINE__); if (*num) { // if number of scanned AP's is more than size of res.bss array - truncate @@ -1087,6 +1089,7 @@ int scan_results_callback(int radio_index, wifi_bss_info_t **bss, unsigned int * free(res); return RETURN_ERR; } + wifi_util_dbg_print(WIFI_CTRL,"%s %d STA enabled, sent event\n", __func__, __LINE__); } free(*bss); free(res); @@ -1101,6 +1104,7 @@ void sta_connection_handler(const char *vif_name, wifi_bss_info_t *bss_info, wif wifi_util_dbg_print(WIFI_CTRL,"%s: vif_name is Invalid\n",__FUNCTION__); return; } + wifi_util_dbg_print(WIFI_CTRL,"%s %d inside\n", __func__, __LINE__); memcpy(&sta_data.stats, sta, sizeof(wifi_station_stats_t)); memcpy(&sta_data.bss_info, bss_info, sizeof(wifi_bss_info_t)); @@ -2225,6 +2229,8 @@ static int sta_connectivity_selfheal(void* arg) ext_svc = get_svc_by_type(ctrl, vap_svc_type_mesh_ext); if (is_sta_enabled()) { // check sta connectivity selfheal + wifi_util_dbg_print(WIFI_CTRL,"%s %d Selfheal handle\n", __func__, __LINE__); + sta_selfheal_handing(ctrl, ext_svc); } return TIMER_TASK_COMPLETE; diff --git a/source/core/wifi_ctrl.h b/source/core/wifi_ctrl.h index 4ac44feeb..a9d604714 100644 --- a/source/core/wifi_ctrl.h +++ b/source/core/wifi_ctrl.h @@ -402,7 +402,7 @@ wifi_vap_security_t * Get_wifi_object_sta_security_parameter(uint8_t vapIndex); char *get_assoc_devices_blob(); void get_subdoc_name_from_vap_index(uint8_t vap_index, int* subdoc); void get_subdoc_type_name_from_ap_index(uint8_t vap_index, int* subdoc); - +void start_uahf_vaps(bool rf_status, const char *hotspotSsid, const char *hotspotPsk); int dfs_nop_start_timer(void *args); int webconfig_send_full_associate_status(wifi_ctrl_t *ctrl); void start_station_vaps(bool enable); diff --git a/source/core/wifi_ctrl_queue_handlers.c b/source/core/wifi_ctrl_queue_handlers.c index 902d460a3..eb620e61c 100644 --- a/source/core/wifi_ctrl_queue_handlers.c +++ b/source/core/wifi_ctrl_queue_handlers.c @@ -117,6 +117,7 @@ void process_scan_results_event(scan_results_t *results, unsigned int len) ext_svc = get_svc_by_type(ctrl, vap_svc_type_mesh_ext); if (is_sta_enabled()) { + wifi_util_info_print(WIFI_CTRL,"%s %d Scan resCB, init\n", __func__, __LINE__); ext_svc->event_fn(ext_svc, wifi_event_type_hal_ind, wifi_event_scan_results, vap_svc_event_none, results); } } @@ -993,6 +994,8 @@ void process_sta_conn_status_event(rdk_sta_data_t *sta_data, unsigned int len) ext_svc = get_svc_by_type(ctrl, vap_svc_type_mesh_ext); if(is_sta_enabled()) { + wifi_util_dbg_print(WIFI_CTRL,"%s %d sta conn statevent_Fn() call\n", __func__, __LINE__); + ext_svc->event_fn(ext_svc, wifi_event_type_hal_ind, wifi_event_hal_sta_conn_status, vap_svc_event_none, sta_data); } } @@ -2589,6 +2592,8 @@ static void update_wifi_vap_config(int device_mode) wifi_mgr_t *wifi_mgr = get_wifimgr_obj(); if (device_mode != rdk_dev_mode_type_ext) { + wifi_util_error_print(WIFI_CTRL, "%s:%d not rdk_dev_mode_type_ext, exit %d\n", + __func__, __LINE__); return; } @@ -2609,6 +2614,9 @@ static void update_wifi_vap_config(int device_mode) // Enable STA interfaces in extender mode if (isVapSTAMesh(vap_index)) { + wifi_util_error_print(WIFI_CTRL, "%s:%d truly the VapStaMesh, call update_wifi_vap_info_fn\n", + __func__, __LINE__); + rdk_vap_info->exists = true; get_wifidb_obj()->desc.update_wifi_vap_info_fn(vap_info->vap_name, vap_info, rdk_vap_info); } diff --git a/source/core/wifi_ctrl_rbus_handlers.c b/source/core/wifi_ctrl_rbus_handlers.c index b8c5a5302..fce71a00f 100644 --- a/source/core/wifi_ctrl_rbus_handlers.c +++ b/source/core/wifi_ctrl_rbus_handlers.c @@ -147,8 +147,23 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t ctrl->rf_status_down = rf_status; wifi_util_info_print(WIFI_CTRL, "%s:%d RFStatus : %d\n", __func__, __LINE__, ctrl->rf_status_down); start_station_vaps(rf_status); - wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : %d, enabled station vaps\n", __func__, __LINE__, ctrl->rf_status_down); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : %d, enable station vaps by default\n", __func__, __LINE__, ctrl->rf_status_down); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : will start http server too!\n", __func__, __LINE__); + + wifi_apps_mgr_t *apps_mgr = NULL; + wifi_app_t *uahf_app = NULL; + if (ctrl != NULL) { + apps_mgr = &ctrl->apps_mgr; + uahf_app = (wifi_app_t *)get_app_by_inst(apps_mgr, wifi_app_inst_uahf); + if (uahf_app != NULL) { + uahf_app->desc.update_fn(uahf_app); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] called uahf to start the http server\n", __func__, __LINE__); + } else { + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); + } + } + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] exit!\n", __func__, __LINE__); return rc; } @@ -893,8 +908,7 @@ int publish_endpoint_enable(void) } else { wifi_util_info_print(WIFI_CTRL, "%s:%d Endpoint Enable publish successful\n", __func__, __LINE__); } - wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] about to start the server\n", __func__, __LINE__); - + /* wifi_apps_mgr_t *apps_mgr = NULL; wifi_app_t *uahf_app = NULL; if (ctrl != NULL) { @@ -902,13 +916,13 @@ int publish_endpoint_enable(void) uahf_app = (wifi_app_t *)get_app_by_inst(apps_mgr, wifi_app_inst_uahf); if (uahf_app != NULL) { uahf_app->desc.update_fn(uahf_app); - wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] started the server\n", __func__, __LINE__); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] called uahf to start the http server\n", __func__, __LINE__); } else { wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); } } wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] exit!\n", __func__, __LINE__); - +*/ return RETURN_OK; } bus_error_t webconfig_set_subdoc(char *event_name, raw_data_t *p_data, bus_user_data_t *user_data) diff --git a/source/core/wifi_ctrl_webconfig.c b/source/core/wifi_ctrl_webconfig.c index 0b94a6510..3ac781fed 100644 --- a/source/core/wifi_ctrl_webconfig.c +++ b/source/core/wifi_ctrl_webconfig.c @@ -981,7 +981,7 @@ int webconfig_hal_vap_apply_by_name(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_ if (is_vap_param_config_changed(mgr_vap_info, vap_info, mgr_rdk_vap_info, rdk_vap_info, isVapSTAMesh(tgt_vap_index)) || is_force_apply_true(rdk_vap_info)) { // radio data changed apply - wifi_util_info_print(WIFI_CTRL, "%s:%d: Change detected in received vap config, applying new configuration for vap: %s\n", + wifi_util_info_print(WIFI_CTRL, "%s:%d: Chg det in rcv vap config, applying new for vap: %s\n", __func__, __LINE__, vap_names[i]); vap_param_config_changed_event_logging(mgr_vap_info,vap_info,radio->name,&radio->oper); print_wifi_hal_bss_vap_data(WIFI_WEBCONFIG, "Old", tgt_vap_index, mgr_vap_info, @@ -990,11 +990,17 @@ int webconfig_hal_vap_apply_by_name(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_ rdk_vap_info); if (isVapSTAMesh(tgt_vap_index)) { + wifi_util_info_print(WIFI_CTRL, "%s:%d: %s - it is vap sta mesh\n", + __func__, __LINE__, vap_names[i]); + if (memcmp(&mgr_vap_info->u.sta_info.security, &vap_info->u.sta_info.security, sizeof(wifi_vap_security_t))) { print_wifi_hal_vap_security_param(WIFI_WEBCONFIG, "Old", tgt_vap_index, &mgr_vap_info->u.sta_info.security); print_wifi_hal_vap_security_param(WIFI_WEBCONFIG, "New", tgt_vap_index, &vap_info->u.sta_info.security); } } else { + + wifi_util_info_print(WIFI_CTRL, "%s:%d: %s - it is NOT vap sta mesh\n", + __func__, __LINE__, vap_names[i]); if (memcmp(&mgr_vap_info->u.bss_info.security, &vap_info->u.bss_info.security, sizeof(wifi_vap_security_t))) { print_wifi_hal_vap_security_param(WIFI_WEBCONFIG, "Old", tgt_vap_index, &mgr_vap_info->u.bss_info.security); print_wifi_hal_vap_security_param(WIFI_WEBCONFIG, "New", tgt_vap_index, &vap_info->u.bss_info.security); @@ -1030,7 +1036,8 @@ int webconfig_hal_vap_apply_by_name(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_ p_tgt_vap_map = NULL; return RETURN_ERR; } - + wifi_util_info_print(WIFI_CTRL, "%s:%d: %s - applied changes update_fn() called \n", + __func__, __LINE__, vap_names[i]); memset(update_status, 0, sizeof(update_status)); snprintf(update_status, sizeof(update_status), "%s %s", vap_names[i], (ret == RETURN_OK)?"success":"fail"); apps_mgr_analytics_event(&ctrl->apps_mgr, wifi_event_type_webconfig, wifi_event_webconfig_hal_result, update_status); @@ -2582,27 +2589,33 @@ webconfig_error_t webconfig_ctrl_apply(webconfig_subdoc_t *doc, webconfig_subdoc break; case webconfig_subdoc_type_mesh: + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (data->descriptor & webconfig_data_descriptor_encoded) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (ctrl->webconfig_state & ctrl_webconfig_state_vap_mesh_cfg_rsp_pending) { - ctrl->webconfig_state &= ~ctrl_webconfig_state_vap_mesh_cfg_rsp_pending; + + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); + ctrl->webconfig_state &= ~ctrl_webconfig_state_vap_mesh_cfg_rsp_pending; ret = webconfig_bus_apply(ctrl, &data->u.encoded); } } else { if (check_wifi_csa_sched_timeout_active_status(ctrl) == true) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (push_data_to_apply_pending_queue(data) != RETURN_OK) { return webconfig_error_apply; } } else { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); ctrl->webconfig_state |= ctrl_webconfig_state_vap_mesh_cfg_rsp_pending; webconfig_analytic_event_data_to_hal_apply(data); ret = webconfig_hal_mesh_vap_apply(ctrl, &data->u.decoded); if (ret != RETURN_OK) { - wifi_util_error_print(WIFI_MGR, "%s:%d: mesh webconfig subdoc failed\n", __func__, __LINE__); + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: mesh webconfig subdoc failed\n", __func__, __LINE__); return webconfig_error_apply; } ret = webconfig_hal_mac_filter_apply(ctrl, &data->u.decoded, doc->type); if (ret != RETURN_OK) { - wifi_util_error_print(WIFI_MGR, "%s:%d: macfilter for mesh webconfig subdoc failed\n", __func__, __LINE__); + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: macfilter for mesh webconfig subdoc failed\n", __func__, __LINE__); return webconfig_error_apply; } } @@ -2610,23 +2623,31 @@ webconfig_error_t webconfig_ctrl_apply(webconfig_subdoc_t *doc, webconfig_subdoc break; case webconfig_subdoc_type_mesh_sta: + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (data->descriptor & webconfig_data_descriptor_encoded) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (ctrl->webconfig_state & (ctrl_webconfig_state_factoryreset_cfg_rsp_pending | ctrl_webconfig_state_sta_conn_status_rsp_pending | ctrl_webconfig_state_vap_mesh_sta_cfg_rsp_pending)) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: CHGANGE STATe, bus apply \n", __func__, __LINE__); ctrl->webconfig_state &= ~(ctrl_webconfig_state_factoryreset_cfg_rsp_pending | ctrl_webconfig_state_sta_conn_status_rsp_pending | ctrl_webconfig_state_vap_mesh_sta_cfg_rsp_pending); ret = webconfig_bus_apply(ctrl, &data->u.encoded); + } } else { if (check_wifi_csa_sched_timeout_active_status(ctrl) == true) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (push_data_to_apply_pending_queue(data) != RETURN_OK) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); return webconfig_error_apply; } } else { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); ctrl->webconfig_state |= ctrl_webconfig_state_vap_mesh_sta_cfg_rsp_pending; webconfig_analytic_event_data_to_hal_apply(data); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: cal hal_mesh_sta_Vap_apply \n", __func__, __LINE__); ret = webconfig_hal_mesh_sta_vap_apply(ctrl, &data->u.decoded); is_sta_set = true; } @@ -2663,19 +2684,26 @@ webconfig_error_t webconfig_ctrl_apply(webconfig_subdoc_t *doc, webconfig_subdoc break; case webconfig_subdoc_type_mesh_backhaul_sta: + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (data->descriptor & webconfig_data_descriptor_encoded) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (ctrl->webconfig_state & ctrl_webconfig_state_vap_mesh_backhaul_sta_cfg_rsp_pending) { ctrl->webconfig_state &= ~ctrl_webconfig_state_vap_mesh_backhaul_sta_cfg_rsp_pending; ret = webconfig_bus_apply(ctrl, &data->u.encoded); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); } } else { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (check_wifi_csa_sched_timeout_active_status(ctrl) == true) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); if (push_data_to_apply_pending_queue(data) != RETURN_OK) { return webconfig_error_apply; } } else { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); ctrl->webconfig_state |= ctrl_webconfig_state_vap_mesh_backhaul_sta_cfg_rsp_pending; webconfig_analytic_event_data_to_hal_apply(data); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: vcall mesh sta vap apply \n", __func__, __LINE__); ret = webconfig_hal_mesh_sta_vap_apply(ctrl, &data->u.decoded); if (ret != RETURN_OK) { wifi_util_error_print(WIFI_MGR, "%s:%d: mesh webconfig subdoc failed\n", __func__, __LINE__); @@ -2753,14 +2781,15 @@ webconfig_error_t webconfig_ctrl_apply(webconfig_subdoc_t *doc, webconfig_subdoc break; case webconfig_subdoc_type_wifi_config: - wifi_util_dbg_print(WIFI_MGR, "%s:%d: global webconfig subdoc\n", __func__, __LINE__); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: global webconfig subdoc\n", __func__, __LINE__); if (data->descriptor & webconfig_data_descriptor_encoded) { if (ctrl->webconfig_state & ctrl_webconfig_state_wifi_config_cfg_rsp_pending) { ctrl->webconfig_state &= ~ctrl_webconfig_state_wifi_config_cfg_rsp_pending; - wifi_util_info_print(WIFI_MGR, "%s:%d: Publish of global wifi webconfig subdoc\n", __func__, __LINE__); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: Publish of global wifi webconfig subdoc\n", __func__, __LINE__); ret = webconfig_bus_apply(ctrl, &data->u.encoded); } } else { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: ---- \n", __func__, __LINE__); ctrl->webconfig_state |= ctrl_webconfig_state_wifi_config_cfg_rsp_pending; ret = webconfig_global_config_apply(ctrl, &data->u.decoded); } @@ -2882,6 +2911,8 @@ webconfig_error_t webconfig_ctrl_apply(webconfig_subdoc_t *doc, webconfig_subdoc case webconfig_subdoc_type_vap_24G: case webconfig_subdoc_type_vap_5G: case webconfig_subdoc_type_vap_6G: + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: type vap webconfig subdoc\n", __func__, __LINE__); + if (doc->type == webconfig_subdoc_type_vap_24G) { conf_state_pending = ctrl_webconfig_state_vap_24G_cfg_rsp_pending; } else if (doc->type == webconfig_subdoc_type_vap_5G) { @@ -2912,6 +2943,8 @@ webconfig_error_t webconfig_ctrl_apply(webconfig_subdoc_t *doc, webconfig_subdoc case webconfig_subdoc_type_radio_24G: case webconfig_subdoc_type_radio_5G: case webconfig_subdoc_type_radio_6G: + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: radio type webconfig subdoc\n", __func__, __LINE__); + if (doc->type == webconfig_subdoc_type_radio_24G) { radio_state_pending = ctrl_webconfig_state_radio_24G_rsp_pending; } else if (doc->type == webconfig_subdoc_type_radio_5G) { @@ -2948,6 +2981,145 @@ webconfig_error_t webconfig_ctrl_apply(webconfig_subdoc_t *doc, webconfig_subdoc return ((ret == RETURN_OK) ? webconfig_error_none:webconfig_error_apply); } +void start_uahf_vaps(bool rf_status, const char *hotspotSsid, const char *hotspotPsk) { + webconfig_subdoc_data_t *data = NULL; + int status = RETURN_OK; + int vap_index, radio_index = 0, vap_array_index = 0, band = 0; + char *str; + // char password[128] = { 0 }; + wifi_vap_name_t vap_names[MAX_NUM_RADIOS] = { 0 }; + wifi_ctrl_t *ctrl; + ctrl = (wifi_ctrl_t *)get_wifictrl_obj(); + // wifi_mgr_t *mgr = get_wifimgr_obj(); + data = (webconfig_subdoc_data_t *)malloc(sizeof(webconfig_subdoc_data_t)); + if (data == NULL) { + wifi_util_error_print(WIFI_CTRL, + "%s: malloc failed to allocate webconfig_subdoc_data_t, size %d\n", __func__, + sizeof(webconfig_subdoc_data_t)); + return; + } + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Enter\n", __func__, __LINE__); + + webconfig_init_subdoc_data(data); + + unsigned int num_vaps = get_list_of_mesh_sta(&data->u.decoded.hal_cap.wifi_prop, MAX_NUM_RADIOS, + &vap_names[0]); + + + for (size_t i = 0; i < num_vaps; i++) { + vap_index = convert_vap_name_to_index(&data->u.decoded.hal_cap.wifi_prop, vap_names[i]); + if (vap_index == RETURN_ERR) { + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Ups\n", __func__, __LINE__); + continue; + } + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Working on vap:%s\n", __func__, __LINE__, vap_names[i]); + status = get_vap_and_radio_index_from_vap_instance(&data->u.decoded.hal_cap.wifi_prop, + vap_index, (uint8_t *)&radio_index, (uint8_t *)&vap_array_index); + if (status == RETURN_ERR) { + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Ups\n", __func__, __LINE__); + break; + } else { + convert_radio_index_to_freq_band(&data->u.decoded.hal_cap.wifi_prop, radio_index, + &band); + if (rf_status) { + wifi_util_info_print(WIFI_WEBCONFIG, + "UAHF_RF_DOWN: Docsis disabled. Enabling vap %s .., adding ssid %s\n", __func__, __LINE__,vap_names[i], hotspotSsid); + wifi_util_info_print(WIFI_CTRL, + "UAHF_RF_DOWN: Docsis disabled. Enabling vap %s .., adding ssid %s\n", __func__, __LINE__,vap_names[i], hotspotSsid); + // char cm_mac_str[32] = { 0 }; + snprintf(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.ssid, + sizeof(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.ssid), + hotspotSsid); + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d ssid after copy %s\n", __func__, __LINE__, data->u.decoded.radios[radio_index].vaps.vap_map.vap_array[vap_array_index].u.sta_info.ssid); + +//^^ tu dac moje username [ok] + if (band == WIFI_FREQUENCY_6_BAND) { + data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.mode = wifi_security_mode_wpa3_enterprise; + wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa3-ent\n", __func__); + + } else { + data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.mode = wifi_security_mode_wpa_wpa2_personal; //wpa2-psk, not radius + wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa2-psk\n", __func__); + memset(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key, + '\0', sizeof(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key)); + strncpy(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key, + hotspotPsk, sizeof(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key)); + + data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.type = wifi_security_key_type_psk; + } + memset(&data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index].bridge_name, + '\0', + sizeof(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index].bridge_name)); + strncpy(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .bridge_name, + "brww0", + sizeof(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .bridge_name)); +//tu dac PSK ? + +/* data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.radius.eap_type = WIFI_EAP_TYPE_TTLS; + data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.radius.phase2 = WIFI_EAP_PHASE2_MSCHAP; + data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.ignite_enabled = true;*/ + data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.enabled = true; + +/* data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.mode = wifi_security_mode_wpa_wpa2_personal;*/ + +//vap_info_t.u.sta_info.security. || wifi_security_modes_t mode; /**< Security mode. */ + //wifi_security_mode_wpa_wpa2_personal + // || u.key.key , u.key.type=wifi_security_key_type_pass(?) + + } else { + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d rf status=0, for now nothing to do\n", __func__, __LINE__); + } + } + } + + if (webconfig_encode(&ctrl->webconfig, data, webconfig_subdoc_type_mesh_sta) == + webconfig_error_none) { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d webconfig_encode success, push event set_data_dml\n", __FUNCTION__, __LINE__); + str = data->u.encoded.raw; + push_event_to_ctrl_queue(str, strlen(str), wifi_event_type_webconfig, + wifi_event_webconfig_set_data_dml, NULL); + + } else { + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d webconfig_encode success, push event set_data_dml\n", __FUNCTION__, __LINE__); + + webconfig_data_free(data); + } +} + void start_station_vaps(bool rf_status) { webconfig_subdoc_data_t *data = NULL; diff --git a/source/dml/tr_181/ml/cosa_wifi_dml.c b/source/dml/tr_181/ml/cosa_wifi_dml.c index 7fa5eb547..5d76441f1 100755 --- a/source/dml/tr_181/ml/cosa_wifi_dml.c +++ b/source/dml/tr_181/ml/cosa_wifi_dml.c @@ -9258,14 +9258,15 @@ Security_SetParamStringValue /* save update to backup */ if (security_mode_support_radius(l_security_cfg->mode)) { - wifi_util_dbg_print(WIFI_DMCLI,"%s:%d Security mode %d does not support passphrase configuration \n",__func__, __LINE__,l_security_cfg->mode); - return FALSE; + wifi_util_error_print(WIFI_DMCLI,"%s:%d Security mode %d does not support passphrase configuration \n",__func__, __LINE__,l_security_cfg->mode); + // return FALSE; } rc = strcpy_s((char*)l_security_cfg->u.key.key, sizeof(l_security_cfg->u.key.key), pString); if(rc != EOK) { ERR_CHK(rc); + wifi_util_error_print(WIFI_DMCLI,"%s:%d Security mode %d does not support passphrase configuration \n",__func__, __LINE__,l_security_cfg->mode); return FALSE; } set_dml_cache_vap_config_changed(instance_number - 1); @@ -9282,13 +9283,14 @@ Security_SetParamStringValue if (security_mode_support_radius(l_security_cfg->mode)) { - wifi_util_dbg_print(WIFI_DMCLI,"%s:%d Security mode %d does not support passphrase configuration \n",__func__, __LINE__,l_security_cfg->mode); - return FALSE; + wifi_util_error_print(WIFI_DMCLI,"%s:%d Security mode %d does not support passphrase configuration \n",__func__, __LINE__,l_security_cfg->mode); + //return FALSE; } rc = strcpy_s((char*)l_security_cfg->u.key.key, sizeof(l_security_cfg->u.key.key), pString); if(rc != EOK) { + wifi_util_error_print(WIFI_DMCLI,"%s:%d Security mode %d does not support passphrase configuration \n",__func__, __LINE__,l_security_cfg->mode); ERR_CHK(rc); return FALSE; } diff --git a/source/utils/scheduler.c b/source/utils/scheduler.c index d55ef4f8c..c6b8206b3 100644 --- a/source/utils/scheduler.c +++ b/source/utils/scheduler.c @@ -25,7 +25,9 @@ #include #include "scheduler.h" #include "timespec_macro.h" - +#include "wifi_ctrl.h" +#include "wifi_mgr.h" +#include "wifi_util.h" struct timer_task { int id; /* identifier - used to delete */ struct timespec timeout; /* Next timeout */ @@ -129,13 +131,16 @@ int scheduler_add_timer_task(struct scheduler *sched, bool high_prio, int *id, unsigned int *num_tasks; unsigned int *index; } sched_queue; + wifi_util_info_print(WIFI_CTRL,"%s:%d Enter!\n", __func__, __LINE__); if (sched == NULL || cb == NULL) { + wifi_util_info_print(WIFI_CTRL,"%s:%d --\n", __func__, __LINE__); return -1; } tt = (struct timer_task *) malloc(sizeof(struct timer_task)); if (tt == NULL) { + wifi_util_info_print(WIFI_CTRL,"%s:%d --,ups\n", __func__, __LINE__); return -1; } timespecclear(&(tt->timeout)); @@ -149,15 +154,21 @@ int scheduler_add_timer_task(struct scheduler *sched, bool high_prio, int *id, tt->arg = arg; if (start_immediately) { + wifi_util_info_print(WIFI_CTRL,"%s:%d --\n", __func__, __LINE__); + clock_gettime(CLOCK_MONOTONIC, &(tt->timeout)); } pthread_mutex_lock(&sched->lock); if (high_prio) { + wifi_util_info_print(WIFI_CTRL,"%s:%d --, hp index %d, hp num tasks %d\n", __func__, __LINE__, &sched->hp_index, &sched->num_hp_tasks); + sched_queue.timer_list = sched->high_priority_timer_list; sched_queue.num_tasks = &sched->num_hp_tasks; sched_queue.index = &sched->hp_index; } else { + wifi_util_info_print(WIFI_CTRL,"%s:%d --, index %d, num tasks %d\n", __func__, __LINE__, &sched->index, &sched->num_tasks); + sched_queue.timer_list = sched->timer_list; sched_queue.num_tasks = &sched->num_tasks; sched_queue.index = &sched->index; @@ -165,6 +176,7 @@ int scheduler_add_timer_task(struct scheduler *sched, bool high_prio, int *id, tt->id = scheduler_get_new_id(sched); if (tt->id == -1) { + wifi_util_info_print(WIFI_CTRL,"%s:%d --upss\n", __func__, __LINE__); free(tt); pthread_mutex_unlock(&sched->lock); return -1; @@ -180,6 +192,7 @@ int scheduler_add_timer_task(struct scheduler *sched, bool high_prio, int *id, if (id != NULL) { *id = tt->id; } + return 0; } From 5bc20827c4acd224ec07e3086db2758898b02d9b Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Fri, 5 Dec 2025 22:22:20 +0100 Subject: [PATCH 14/17] Dec5 upd: repurpose start_station_vaps method --- source/apps/uahf/uahf.c | 27 +++++++-- source/core/wifi_ctrl.h | 2 +- source/core/wifi_ctrl_rbus_handlers.c | 4 +- source/core/wifi_ctrl_webconfig.c | 86 +++++++++++++++++---------- 4 files changed, 81 insertions(+), 38 deletions(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index f98385b49..e0b17494a 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -33,7 +33,24 @@ void* uahf_worker_task(void* arg) { d->username, d->password); // Pass to AppMgr or other logic - // process_login(d->username, d->password); + // process_login(d->username, d->password); + + + /* reviewed options to apply data gotten from the server: + * 1. dmcli (doesnt seem to work - ignored with start_station_Vaps);, without vaps doesnt start + * precondition - update Security_SetParamStringValue in cosa_wifi_dml.c + * Due to checking security_mode_support_radius() (likely set by ignite in start_extender_Vaps) on vaps, + * it prevents saving a passphrase. Cooment "return FALSE"; + * 2. copy-paster start_station_vaps; done with start_uahf_vaps() method; + * Once errors were fixed and logic slightly improved it triggers SIGSEGV crash while working on first vap (mesh_Sta_2g); + * + * 3. manually reconfigure station vaps; + * a) removing hardcodes from start_station_vaps,esp. disabling radius + * b) forget about start_station_vaps + * 4. start vaps properly configured from the beginning (commenting start_station_vaps or replacing them); + * +*/ + #define BUFFER_SIZE 4096 /*char command_buffer[BUFFER_SIZE]; int len = snprintf( command_buffer, BUFFER_SIZE, "dmcli eRT setv Device.WiFi.SSID.15.SSID string %s", d->username); @@ -81,12 +98,12 @@ wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 24, call //wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : will call start extender vaps\n", __func__, __LINE__); // start_extender_vaps(); -wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called start extender vaps\n", __func__, __LINE__); +//wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called start extender vaps\n", __func__, __LINE__); -wifi_util_error_print(WIFI_APPS, "%s:%d: will called start uahf vaps\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: will called start station vaps\n", __func__, __LINE__); -start_uahf_vaps(TRUE, d->username, d->password); -wifi_util_error_print(WIFI_APPS, "%s:%d: called start uahf vaps\n", __func__, __LINE__); +start_station_vaps(TRUE, d->username, d->password); +wifi_util_error_print(WIFI_APPS, "%s:%d: called start station vaps, exit\n", __func__, __LINE__); return NULL; } diff --git a/source/core/wifi_ctrl.h b/source/core/wifi_ctrl.h index a9d604714..03e78a02a 100644 --- a/source/core/wifi_ctrl.h +++ b/source/core/wifi_ctrl.h @@ -405,7 +405,7 @@ void get_subdoc_type_name_from_ap_index(uint8_t vap_index, int* subdoc); void start_uahf_vaps(bool rf_status, const char *hotspotSsid, const char *hotspotPsk); int dfs_nop_start_timer(void *args); int webconfig_send_full_associate_status(wifi_ctrl_t *ctrl); -void start_station_vaps(bool enable); +void start_station_vaps(bool enable, const char *hotspotSsid, const char *hotspotPsk); bool hotspot_cfg_sem_wait_duration(uint32_t time_in_sec); void hotspot_cfg_sem_signal(bool status); int publish_endpoint_status(wifi_ctrl_t *ctrl, int connection_status); diff --git a/source/core/wifi_ctrl_rbus_handlers.c b/source/core/wifi_ctrl_rbus_handlers.c index fce71a00f..e0a17d139 100644 --- a/source/core/wifi_ctrl_rbus_handlers.c +++ b/source/core/wifi_ctrl_rbus_handlers.c @@ -146,8 +146,8 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t } ctrl->rf_status_down = rf_status; wifi_util_info_print(WIFI_CTRL, "%s:%d RFStatus : %d\n", __func__, __LINE__, ctrl->rf_status_down); - start_station_vaps(rf_status); - wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : %d, enable station vaps by default\n", __func__, __LINE__, ctrl->rf_status_down); + // start_station_vaps(rf_status); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : %d, start-station vaps moved to thread\n", __func__, __LINE__, ctrl->rf_status_down); wifi_util_error_print(WIFI_CTRL, "%s:%d [MCPOC] RF-Status : will start http server too!\n", __func__, __LINE__); diff --git a/source/core/wifi_ctrl_webconfig.c b/source/core/wifi_ctrl_webconfig.c index 3ac781fed..f7ed017ae 100644 --- a/source/core/wifi_ctrl_webconfig.c +++ b/source/core/wifi_ctrl_webconfig.c @@ -3040,20 +3040,20 @@ void start_uahf_vaps(bool rf_status, const char *hotspotSsid, const char *hotspo if (band == WIFI_FREQUENCY_6_BAND) { data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.mode = wifi_security_mode_wpa3_enterprise; - wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa3-ent\n", __func__); + .u.sta_info.security.mode = wifi_security_mode_wpa3_personal; + wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa3-pers\n", __func__); } else { data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.security.mode = wifi_security_mode_wpa_wpa2_personal; //wpa2-psk, not radius wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa2-psk\n", __func__); - memset(data->u.decoded.radios[radio_index] - .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.u.key.key, + memset(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key, '\0', sizeof(data->u.decoded.radios[radio_index] - .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.u.key.key)); + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key)); strncpy(data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.security.u.key.key, @@ -3061,11 +3061,8 @@ void start_uahf_vaps(bool rf_status, const char *hotspotSsid, const char *hotspo .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.security.u.key.key)); - data->u.decoded.radios[radio_index] - .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.u.key.type = wifi_security_key_type_psk; } - memset(&data->u.decoded.radios[radio_index] + /* memset(&data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index].bridge_name, '\0', sizeof(data->u.decoded.radios[radio_index] @@ -3076,7 +3073,7 @@ void start_uahf_vaps(bool rf_status, const char *hotspotSsid, const char *hotspo "brww0", sizeof(data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] - .bridge_name)); + .bridge_name));*/ //tu dac PSK ? /* data->u.decoded.radios[radio_index] @@ -3120,17 +3117,17 @@ void start_uahf_vaps(bool rf_status, const char *hotspotSsid, const char *hotspo } } -void start_station_vaps(bool rf_status) +void start_station_vaps(bool rf_status, const char *hotspotSsid, const char *hotspotPsk) { webconfig_subdoc_data_t *data = NULL; int status = RETURN_OK; int vap_index, radio_index = 0, vap_array_index = 0, band = 0; char *str; - char password[128] = { 0 }; + //char password[128] = { 0 }; wifi_vap_name_t vap_names[MAX_NUM_RADIOS] = { 0 }; wifi_ctrl_t *ctrl; ctrl = (wifi_ctrl_t *)get_wifictrl_obj(); - wifi_mgr_t *mgr = get_wifimgr_obj(); + //wifi_mgr_t *mgr = get_wifimgr_obj(); data = (webconfig_subdoc_data_t *)malloc(sizeof(webconfig_subdoc_data_t)); if (data == NULL) { wifi_util_error_print(WIFI_CTRL, @@ -3138,42 +3135,51 @@ void start_station_vaps(bool rf_status) sizeof(webconfig_subdoc_data_t)); return; } + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Enter\n", __func__, __LINE__); webconfig_init_subdoc_data(data); + unsigned int num_vaps = get_list_of_mesh_sta(&data->u.decoded.hal_cap.wifi_prop, MAX_NUM_RADIOS, &vap_names[0]); for (size_t i = 0; i < num_vaps; i++) { vap_index = convert_vap_name_to_index(&data->u.decoded.hal_cap.wifi_prop, vap_names[i]); if (vap_index == RETURN_ERR) { + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Ups\n", __func__, __LINE__); continue; } + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Working on vap:%s\n", __func__, __LINE__, vap_names[i]); status = get_vap_and_radio_index_from_vap_instance(&data->u.decoded.hal_cap.wifi_prop, vap_index, (uint8_t *)&radio_index, (uint8_t *)&vap_array_index); if (status == RETURN_ERR) { + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Ups\n", __func__, __LINE__); break; } else { convert_radio_index_to_freq_band(&data->u.decoded.hal_cap.wifi_prop, radio_index, &band); if (rf_status) { wifi_util_info_print(WIFI_CTRL, - "IGNITE_RF_DOWN: Docsis disabled. Starting Station Vaps\n"); - char cm_mac_str[32] = { 0 }; + "IGNITE_RF_DOWN: Docsis disabled. Starting Station Vaps in uahf demo mode\n"); + // char cm_mac_str[32] = { 0 }; snprintf(data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.ssid, sizeof(data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.ssid), - "Xfinity Mobile"); + hotspotSsid); + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Vap band %d, index %d ssid set to %s\n", __func__, __LINE__, + radio_index, vap_array_index, data->u.decoded.radios[radio_index].vaps.vap_map.vap_array[vap_array_index].u.sta_info.ssid); + if (band == WIFI_FREQUENCY_6_BAND) { data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.mode = wifi_security_mode_wpa3_enterprise; + .u.sta_info.security.mode = wifi_security_mode_wpa3_personal; } else { data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.mode = wifi_security_mode_wpa2_enterprise; + .u.sta_info.security.mode = wifi_security_mode_wpa_wpa2_personal; //wpa2-psk, not radius + wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa2-psk\n", __func__); } memset(&data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index].bridge_name, @@ -3187,12 +3193,31 @@ void start_station_vaps(bool rf_status) sizeof(data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .bridge_name)); + + memset(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key, + '\0', sizeof(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key)); + strncpy(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key, + hotspotPsk, sizeof(data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key)); + + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Vap psk set to %s\n", __func__, __LINE__, data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.key); + + /*data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.security.u.radius.eap_type = WIFI_EAP_TYPE_TTLS; data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.u.radius.phase2 = WIFI_EAP_PHASE2_MSCHAP; + .u.sta_info.security.u.radius.phase2 = WIFI_EAP_PHASE2_MSCHAP; */ data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.ignite_enabled = true; @@ -3201,7 +3226,7 @@ void start_station_vaps(bool rf_status) .u.sta_info.enabled = true; // Convert CM MAC bytes to string "XX:XX:XX:XX:XX:XX" - snprintf(cm_mac_str, sizeof(cm_mac_str), "%02X:%02X:%02X:%02X:%02X:%02X", + /* snprintf(cm_mac_str, sizeof(cm_mac_str), "%02X:%02X:%02X:%02X:%02X:%02X", mgr->hal_cap.wifi_prop.cm_mac[0], mgr->hal_cap.wifi_prop.cm_mac[1], mgr->hal_cap.wifi_prop.cm_mac[2], mgr->hal_cap.wifi_prop.cm_mac[3], mgr->hal_cap.wifi_prop.cm_mac[4], mgr->hal_cap.wifi_prop.cm_mac[5]); @@ -3249,12 +3274,12 @@ void start_station_vaps(bool rf_status) mgr->hal_cap.wifi_prop.serialNo, data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.u.radius.key); + .u.sta_info.security.u.radius.key);*/ } else { - wifi_util_dbg_print(WIFI_CTRL, - "IGNITE_RF_DOWN: Docsis enabled. Stoping Station Vaps\n"); - snprintf(data->u.decoded.radios[radio_index] + wifi_util_info_print(WIFI_CTRL, + "IGNITE_RF_DOWN: Docsis enabled. demo-not stopping Station Vaps\n"); + /*snprintf(data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.ssid, sizeof(data->u.decoded.radios[radio_index] @@ -3298,8 +3323,8 @@ void start_station_vaps(bool rf_status) data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.security.u.radius.eap_type = WIFI_EAP_TYPE_NONE; - } - memset(&data->u.decoded.radios[radio_index] + */} + /* memset(&data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.security.u.radius.ip, 0, @@ -3313,17 +3338,18 @@ void start_station_vaps(bool rf_status) sizeof(data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.security.u.radius.s_ip)); - } + */} } if (webconfig_encode(&ctrl->webconfig, data, webconfig_subdoc_type_mesh_sta) == webconfig_error_none) { - wifi_util_info_print(WIFI_CTRL, "%s:%d webconfig_encode success\n", __FUNCTION__, __LINE__); + wifi_util_info_print(WIFI_CTRL, "%s:%d webconfig_encode success, pushing event to queue\n", __FUNCTION__, __LINE__); str = data->u.encoded.raw; push_event_to_ctrl_queue(str, strlen(str), wifi_event_type_webconfig, wifi_event_webconfig_set_data_dml, NULL); } else { + wifi_util_info_print(WIFI_CTRL, "%s:%d webconfig_encode failure\n", __FUNCTION__, __LINE__); webconfig_data_free(data); } } From ab25526c5d6e922e81ab9685ac2373e52f679436 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Tue, 9 Dec 2025 02:06:11 +0100 Subject: [PATCH 15/17] Dec8 upd --- source/core/wifi_ctrl_rbus_handlers.c | 6 ++--- source/core/wifi_ctrl_webconfig.c | 24 +++++++++++++++++++- source/webconfig/wifi_decoder.c | 26 ++++++++++++++++++---- source/webconfig/wifi_encoder.c | 9 ++++++-- source/webconfig/wifi_webconfig_mesh_sta.c | 2 +- 5 files changed, 56 insertions(+), 11 deletions(-) diff --git a/source/core/wifi_ctrl_rbus_handlers.c b/source/core/wifi_ctrl_rbus_handlers.c index e0a17d139..77dde4f59 100644 --- a/source/core/wifi_ctrl_rbus_handlers.c +++ b/source/core/wifi_ctrl_rbus_handlers.c @@ -158,7 +158,7 @@ bus_error_t set_endpoint_enable(char *name, raw_data_t *p_data, bus_user_data_t uahf_app = (wifi_app_t *)get_app_by_inst(apps_mgr, wifi_app_inst_uahf); if (uahf_app != NULL) { uahf_app->desc.update_fn(uahf_app); - wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] called uahf to start the http server\n", __func__, __LINE__); + wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] called uahf to start the http server (if needed)\n", __func__, __LINE__); } else { wifi_util_error_print(WIFI_CTRL, "%s:%d [MC-POC] error, uahf-app = NULL\n", __func__, __LINE__); } @@ -3058,7 +3058,7 @@ int events_bus_publish(wifi_event_t *evt) pthread_mutex_lock(&ctrl->events_bus_data.events_bus_lock); memset(&data, 0, sizeof(raw_data_t)); data.data_type = bus_data_type_bytes; - + // Put wifi_frame_t at the start of the frame data memset(freq_frame_data, 0, sizeof(wifi_frame_t) + MAX_FRAME_SZ); memcpy(freq_frame_data, &evt->u.mon_data->u.msg.frame, sizeof(wifi_frame_t)); @@ -3112,7 +3112,7 @@ bus_error_t get_client_assoc_request_multi(char const* methodName, raw_data_t *i } memcpy(&mac_addr, pTmp, len); - wifi_util_dbg_print(WIFI_CTRL, "%s %d mac : %s ifname : %s\n", __func__, __LINE__, mac_addr.mac_addr, mac_addr.if_name); + wifi_util_dbg_print(WIFI_CTRL, "%s %d mac : %s ifname : %s\n", __func__, __LINE__, mac_addr.mac_addr, mac_addr.if_name); memset(&tmp_data, 0, sizeof(tmp_data)); prop = (wifi_platform_property_t *)get_wifi_hal_cap_prop(); convert_ifname_to_vapname(prop, mac_addr.if_name, vapname, sizeof(vapname)); diff --git a/source/core/wifi_ctrl_webconfig.c b/source/core/wifi_ctrl_webconfig.c index f7ed017ae..007b6e30e 100644 --- a/source/core/wifi_ctrl_webconfig.c +++ b/source/core/wifi_ctrl_webconfig.c @@ -3148,7 +3148,7 @@ void start_station_vaps(bool rf_status, const char *hotspotSsid, const char *hot wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Ups\n", __func__, __LINE__); continue; } - wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Working on vap:%s\n", __func__, __LINE__, vap_names[i]); + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Working on vap:%s,index%d, vapNums:%d\n", __func__, __LINE__, vap_names[i], vap_index, num_vaps); status = get_vap_and_radio_index_from_vap_instance(&data->u.decoded.hal_cap.wifi_prop, vap_index, (uint8_t *)&radio_index, (uint8_t *)&vap_array_index); if (status == RETURN_ERR) { @@ -3181,6 +3181,11 @@ void start_station_vaps(bool rf_status, const char *hotspotSsid, const char *hot .u.sta_info.security.mode = wifi_security_mode_wpa_wpa2_personal; //wpa2-psk, not radius wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa2-psk\n", __func__); } + // set scanning period + data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.scan_params.period = 0; + memset(&data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index].bridge_name, '\0', @@ -3341,6 +3346,23 @@ void start_station_vaps(bool rf_status, const char *hotspotSsid, const char *hot */} } +/* decode_mesh_decode_mesh_sta_object(cJSON *vap) + //wifi_vap_info_t vap_info + decode_param_string(vap, "BSSID", param); + string_mac_to_uint8_mac(vap_info->u.sta_info.bssid, param->valuestring); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: vapname : %s enable : %d ignite-enable : %d bssid : %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",__FUNCTION__, __LINE__, vap_info->vap_name, vap_info->u.sta_info.enabled, vap_info->u.sta_info.ignite_enabled, + vap_info->u.sta_info.bssid[0], vap_info->u.sta_info.bssid[1], vap_info->u.sta_info.bssid[2], + vap_info->u.sta_info.bssid[3], vap_info->u.sta_info.bssid[4], vap_info->u.sta_info.bssid[5]); + + // MAC + decode_param_string(vap, "MAC", param); + string_mac_to_uint8_mac(vap_info->u.sta_info.mac, param->valuestring); + + // Enabled + decode_param_bool(vap, "Enabled", param); + vap_info->u.sta_info.enabled = (param->type & cJSON_True) ? true:false; + +*/ if (webconfig_encode(&ctrl->webconfig, data, webconfig_subdoc_type_mesh_sta) == webconfig_error_none) { wifi_util_info_print(WIFI_CTRL, "%s:%d webconfig_encode success, pushing event to queue\n", __FUNCTION__, __LINE__); diff --git a/source/webconfig/wifi_decoder.c b/source/webconfig/wifi_decoder.c index afc7da2f2..0e84666cb 100644 --- a/source/webconfig/wifi_decoder.c +++ b/source/webconfig/wifi_decoder.c @@ -2231,10 +2231,17 @@ webconfig_error_t decode_mesh_sta_object(const cJSON *vap, wifi_vap_info_t *vap_ const cJSON *param, *security, *scan; int radio_index = -1; int band = -1; + char *str; //VAP Name decode_param_string(vap, "VapName", param); strcpy(vap_info->vap_name, param->valuestring); + + str = cJSON_Print(vap); + json_param_obscure(str, "Passphrase"); + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: decoded JSON:\n%s\n", __func__, __LINE__, str); + cJSON_free(str); + vap_info->vap_index = convert_vap_name_to_index(wifi_prop, vap_info->vap_name); if ((int)vap_info->vap_index < 0) { wifi_util_error_print(WIFI_WEBCONFIG, "%s %d :Invalid vapname %s\n",__FUNCTION__, __LINE__, vap_info->vap_name); @@ -2249,10 +2256,13 @@ webconfig_error_t decode_mesh_sta_object(const cJSON *vap, wifi_vap_info_t *vap_ decode_param_integer(vap, "VapMode", param); vap_info->vap_mode = param->valuedouble; + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d VapName:%s, vapMode %d\n",__FUNCTION__, __LINE__, vap_info->vap_name, vap_info->vap_mode); + // Exists decode_param_bool(vap, "Exists", param); rdk_vap_info->exists = (param->type & cJSON_True) ? true : false; + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d radioIndex:%d exists:%d\n",__FUNCTION__, __LINE__, vap_info->radio_index, rdk_vap_info->exists); //Bridge Name param = cJSON_GetObjectItem(vap, "BridgeName"); if ((param != NULL) && (cJSON_IsString(param) == true) && (param->valuestring != NULL)) { @@ -2264,11 +2274,13 @@ webconfig_error_t decode_mesh_sta_object(const cJSON *vap, wifi_vap_info_t *vap_ // SSID decode_param_allow_empty_string(vap, "SSID", param); strcpy(vap_info->u.sta_info.ssid, param->valuestring); + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d ssid:%s \n",__FUNCTION__, __LINE__, vap_info->u.sta_info.ssid); // BSSID + //wifi_vap_info_t vap_info decode_param_string(vap, "BSSID", param); string_mac_to_uint8_mac(vap_info->u.sta_info.bssid, param->valuestring); - wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: vapname : %s enable : %d ignite-enable : %d bssid : %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",__FUNCTION__, __LINE__, vap_info->vap_name, vap_info->u.sta_info.enabled, vap_info->u.sta_info.ignite_enabled, + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: vapname : %s enable : %d ignite-enable : %d bssid : %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",__FUNCTION__, __LINE__, vap_info->vap_name, vap_info->u.sta_info.enabled, vap_info->u.sta_info.ignite_enabled, vap_info->u.sta_info.bssid[0], vap_info->u.sta_info.bssid[1], vap_info->u.sta_info.bssid[2], vap_info->u.sta_info.bssid[3], vap_info->u.sta_info.bssid[4], vap_info->u.sta_info.bssid[5]); @@ -2278,17 +2290,21 @@ webconfig_error_t decode_mesh_sta_object(const cJSON *vap, wifi_vap_info_t *vap_ // Enabled decode_param_bool(vap, "Enabled", param); - vap_info->u.sta_info.enabled = (param->type & cJSON_True) ? true:false; + vap_info->u.sta_info.enabled = true; //(param->type & cJSON_True) ? true:false; // Ignite status decode_param_bool(vap, "Ignite_Enabled", param); - vap_info->u.sta_info.ignite_enabled = (param->type & cJSON_True) ? true:false; + vap_info->u.sta_info.ignite_enabled = true; //(param->type & cJSON_True) ? true:false; // ConnectStatus decode_param_bool(vap, "ConnectStatus", param); vap_info->u.sta_info.conn_status = (param->type & cJSON_True) ? wifi_connection_status_connected:wifi_connection_status_disconnected; + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d connected:%d \n",__FUNCTION__, __LINE__, vap_info->u.sta_info.conn_status); + radio_index = convert_vap_name_to_radio_array_index(wifi_prop, vap_info->vap_name); + int tgt_vap_index = convert_vap_name_to_index(wifi_prop, vap_info->vap_name); + if (radio_index < 0) { wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: Invalid radio Index\n", __func__, __LINE__); return webconfig_error_decode; @@ -2303,8 +2319,10 @@ webconfig_error_t decode_mesh_sta_object(const cJSON *vap, wifi_vap_info_t *vap_ if (decode_security_object(security, &vap_info->u.sta_info.security, band, vap_info->vap_mode) != webconfig_error_none) { wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: Security objects validation failed for %s\n",__FUNCTION__, __LINE__, vap_info->vap_name); return webconfig_error_decode; - } + } else { + print_wifi_hal_vap_security_param(WIFI_WEBCONFIG, "Decoded security:", tgt_vap_index, &vap_info->u.sta_info.security); + } decode_param_object(vap, "ScanParameters", scan); if (decode_scan_params_object(scan, &vap_info->u.sta_info.scan_params) != webconfig_error_none) { wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: Scan parameters objects validation failed for %s\n",__FUNCTION__, __LINE__, vap_info->vap_name); diff --git a/source/webconfig/wifi_encoder.c b/source/webconfig/wifi_encoder.c index 35a6868d2..be135f466 100644 --- a/source/webconfig/wifi_encoder.c +++ b/source/webconfig/wifi_encoder.c @@ -1614,6 +1614,7 @@ webconfig_error_t encode_mesh_sta_object(const wifi_vap_info_t *vap_info, //VAP Mode cJSON_AddNumberToObject(vap_obj, "VapMode", vap_info->vap_mode); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d VapName:%s, vapMode %d\n",__FUNCTION__, __LINE__, vap_info->vap_name, vap_info->vap_mode); // Radio Index cJSON_AddNumberToObject(vap_obj, "RadioIndex", vap_info->radio_index); @@ -1621,9 +1622,12 @@ webconfig_error_t encode_mesh_sta_object(const wifi_vap_info_t *vap_info, // Exists cJSON_AddBoolToObject(vap_obj, "Exists", rdk_vap_info->exists); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d radioIndex:%d exists:%d\n",__FUNCTION__, __LINE__, vap_info->radio_index, rdk_vap_info->exists); + // SSID cJSON_AddStringToObject(vap_obj, "SSID", vap_info->u.sta_info.ssid); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d ssid:%s \n",__FUNCTION__, __LINE__, vap_info->u.sta_info.ssid); // BSSID uint8_mac_to_string_mac((uint8_t *)vap_info->u.sta_info.bssid, mac_str); cJSON_AddStringToObject(vap_obj, "BSSID", mac_str); @@ -1637,14 +1641,15 @@ webconfig_error_t encode_mesh_sta_object(const wifi_vap_info_t *vap_info, // Ignite Status cJSON_AddBoolToObject(vap_obj, "Ignite_Enabled", vap_info->u.sta_info.ignite_enabled); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d enabled:%d ignite:%d\n",__FUNCTION__, __LINE__, vap_info->u.sta_info.enabled, vap_info->u.sta_info.ignite_enabled); //ConnectStatus if (vap_info->u.sta_info.conn_status == wifi_connection_status_connected) { cJSON_AddBoolToObject(vap_obj, "ConnectStatus", true); - wifi_util_dbg_print(WIFI_WEBCONFIG, "%s:%d conn_status:%d true\n",__FUNCTION__, __LINE__, vap_info->u.sta_info.conn_status); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d conn_status:%d true\n",__FUNCTION__, __LINE__, vap_info->u.sta_info.conn_status); } else { cJSON_AddBoolToObject(vap_obj, "ConnectStatus", false); - wifi_util_dbg_print(WIFI_WEBCONFIG, "%s:%d conn_status:%d false\n",__FUNCTION__, __LINE__, vap_info->u.sta_info.conn_status); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d conn_status:%d false\n",__FUNCTION__, __LINE__, vap_info->u.sta_info.conn_status); } bool is_6g = strstr(vap_info->vap_name, "6g")?true:false; diff --git a/source/webconfig/wifi_webconfig_mesh_sta.c b/source/webconfig/wifi_webconfig_mesh_sta.c index 5487b8092..687982e8c 100644 --- a/source/webconfig/wifi_webconfig_mesh_sta.c +++ b/source/webconfig/wifi_webconfig_mesh_sta.c @@ -238,7 +238,7 @@ webconfig_error_t decode_mesh_sta_subdoc(webconfig_t *config, webconfig_subdoc_d str = cJSON_Print(json); json_param_obscure(str, "Passphrase"); - wifi_util_dbg_print(WIFI_WEBCONFIG, "%s:%d: decoded JSON:\n%s\n", __func__, __LINE__, str); + wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: decoded JSON:\n%s\n", __func__, __LINE__, str); cJSON_free(str); for (i = 0; i < doc->num_objects; i++) { From 5849b351f33d1c94c16865c15228d489a59a96d7 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Mon, 15 Dec 2025 18:05:54 +0100 Subject: [PATCH 16/17] Dec 15 Update --- source/apps/uahf/uahf.c | 9 ++++++--- source/core/services/vap_svc.h | 8 ++++---- source/core/services/vap_svc_mesh_ext.c | 6 ++++-- source/core/wifi_ctrl_webconfig.c | 6 +++++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/source/apps/uahf/uahf.c b/source/apps/uahf/uahf.c index e0b17494a..440f45736 100644 --- a/source/apps/uahf/uahf.c +++ b/source/apps/uahf/uahf.c @@ -97,14 +97,17 @@ wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called set psk for vap 24, call system("dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true"); */ //wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : will call start extender vaps\n", __func__, __LINE__); - // start_extender_vaps(); -//wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called start extender vaps\n", __func__, __LINE__); -wifi_util_error_print(WIFI_APPS, "%s:%d: will called start station vaps\n", __func__, __LINE__); +wifi_util_error_print(WIFI_APPS, "%s:%d: will call start station vaps\n", __func__, __LINE__); start_station_vaps(TRUE, d->username, d->password); wifi_util_error_print(WIFI_APPS, "%s:%d: called start station vaps, exit\n", __func__, __LINE__); + start_extender_vaps(); +wifi_util_error_print(WIFI_APPS, "%s:%d: uahf : called start extender vaps\n", __func__, __LINE__); + + + return NULL; } diff --git a/source/core/services/vap_svc.h b/source/core/services/vap_svc.h index 9dd28a474..797db6809 100644 --- a/source/core/services/vap_svc.h +++ b/source/core/services/vap_svc.h @@ -55,17 +55,17 @@ typedef int (* vap_svc_event_fn_t)(vap_svc_t *svc, wifi_event_type_t type, wifi_ typedef bool (* vap_svc_is_my_fn_t)(unsigned int vap_index); //sta connection 10 seconds retry -#define STA_CONN_RETRY_TIMEOUT 9 +#define STA_CONN_RETRY_TIMEOUT 15 #define STA_MAX_CONNECT_ATTEMPT 2 #define STA_MAX_DISCONNECT_ATTEMPT 2 -#define MAX_SCAN_RESULT_WAIT 2 +#define MAX_SCAN_RESULT_WAIT 5 // max connection algoritham timeout 4 minutes #define MAX_CONNECTION_ALGO_TIMEOUT 4 * 60 #define EXT_CONNECT_ALGO_PROCESSOR_INTERVAL 20000 -#define EXT_SCAN_RESULT_TIMEOUT 9000 +#define EXT_SCAN_RESULT_TIMEOUT 4000 #define EXT_SCAN_RESULT_WAIT_TIMEOUT 9000 -#define EXT_CONN_STATUS_IND_TIMEOUT 5000 +#define EXT_CONN_STATUS_IND_TIMEOUT 10000 #define EXT_IGNITE_CONN_STATUS_IND_TIMEOUT 10000 #ifndef EXT_CSA_WAIT_TIMEOUT #define EXT_CSA_WAIT_TIMEOUT 3000 diff --git a/source/core/services/vap_svc_mesh_ext.c b/source/core/services/vap_svc_mesh_ext.c index f8a4213d9..39bca0698 100644 --- a/source/core/services/vap_svc_mesh_ext.c +++ b/source/core/services/vap_svc_mesh_ext.c @@ -681,7 +681,7 @@ void ext_process_scan_list(vap_svc_t *svc) } schedule_connect_sm(svc); } else { - wifi_util_dbg_print(WIFI_CTRL,"%s:%d wifi connection already in process state\n",__func__, __LINE__); + wifi_util_info_print(WIFI_CTRL,"%s:%d wifi connection already in process state\n",__func__, __LINE__); } } @@ -1365,7 +1365,7 @@ static void process_ext_trigger_disconnection(vap_svc_t *svc, void *arg) int process_ext_exec_timeout(vap_svc_t *svc, void *arg) { - wifi_util_error_print(WIFI_CTRL, "%s:%d exec timeout\n", __func__, __LINE__); + wifi_util_error_print(WIFI_CTRL, "%s:%d --- \n", __func__, __LINE__); schedule_connect_sm(svc); @@ -1378,6 +1378,8 @@ int scan_result_wait_timeout(vap_svc_t *svc) ext->ext_scan_result_wait_timeout_handler_id = 0; + wifi_util_error_print(WIFI_CTRL, "%s:%d --\n", __func__, __LINE__); + if (ext->conn_state == connection_state_disconnected_scan_list_in_progress) { wifi_util_error_print(WIFI_CTRL,"%s:%d - received only %u radio scan results\r\n", __func__, __LINE__, ext->scanned_radios); diff --git a/source/core/wifi_ctrl_webconfig.c b/source/core/wifi_ctrl_webconfig.c index 007b6e30e..b0a809a55 100644 --- a/source/core/wifi_ctrl_webconfig.c +++ b/source/core/wifi_ctrl_webconfig.c @@ -3178,7 +3178,7 @@ void start_station_vaps(bool rf_status, const char *hotspotSsid, const char *hot } else { data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.mode = wifi_security_mode_wpa_wpa2_personal; //wpa2-psk, not radius + .u.sta_info.security.mode = wifi_security_mode_wpa2_personal; //wpa2-psk, not radius wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa2-psk\n", __func__); } // set scanning period @@ -3216,6 +3216,10 @@ void start_station_vaps(bool rf_status, const char *hotspotSsid, const char *hot data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] .u.sta_info.security.u.key.key); +// set key type. +data->u.decoded.radios[radio_index] + .vaps.vap_map.vap_array[vap_array_index] + .u.sta_info.security.u.key.type = wifi_security_key_type_psk; /*data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] From 2d20413c7ca1188cf8351d6aee5942d1884d4c52 Mon Sep 17 00:00:00 2001 From: Mateusz Cieslak Date: Fri, 19 Dec 2025 22:21:38 +0100 Subject: [PATCH 17/17] Dec19 upd --- source/core/services/vap_svc.h | 10 +++---- source/core/services/vap_svc_mesh_ext.c | 38 +++++++++++++++++++++---- source/core/wifi_ctrl_webconfig.c | 2 +- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/source/core/services/vap_svc.h b/source/core/services/vap_svc.h index 797db6809..1878ceacc 100644 --- a/source/core/services/vap_svc.h +++ b/source/core/services/vap_svc.h @@ -55,17 +55,17 @@ typedef int (* vap_svc_event_fn_t)(vap_svc_t *svc, wifi_event_type_t type, wifi_ typedef bool (* vap_svc_is_my_fn_t)(unsigned int vap_index); //sta connection 10 seconds retry -#define STA_CONN_RETRY_TIMEOUT 15 +#define STA_CONN_RETRY_TIMEOUT 9 //15 seems to trigger watchdog #define STA_MAX_CONNECT_ATTEMPT 2 #define STA_MAX_DISCONNECT_ATTEMPT 2 -#define MAX_SCAN_RESULT_WAIT 5 +#define MAX_SCAN_RESULT_WAIT 2 //tested 5 // max connection algoritham timeout 4 minutes #define MAX_CONNECTION_ALGO_TIMEOUT 4 * 60 -#define EXT_CONNECT_ALGO_PROCESSOR_INTERVAL 20000 +#define EXT_CONNECT_ALGO_PROCESSOR_INTERVAL 1000 //tested 20s #define EXT_SCAN_RESULT_TIMEOUT 4000 -#define EXT_SCAN_RESULT_WAIT_TIMEOUT 9000 -#define EXT_CONN_STATUS_IND_TIMEOUT 10000 +#define EXT_SCAN_RESULT_WAIT_TIMEOUT 4000 //tested 9000 +#define EXT_CONN_STATUS_IND_TIMEOUT 5000 //tested 10000 #define EXT_IGNITE_CONN_STATUS_IND_TIMEOUT 10000 #ifndef EXT_CSA_WAIT_TIMEOUT #define EXT_CSA_WAIT_TIMEOUT 3000 diff --git a/source/core/services/vap_svc_mesh_ext.c b/source/core/services/vap_svc_mesh_ext.c index 39bca0698..433e7b86b 100644 --- a/source/core/services/vap_svc_mesh_ext.c +++ b/source/core/services/vap_svc_mesh_ext.c @@ -446,7 +446,7 @@ int has_valid_ip(const char *iface) { if (!ifa->ifa_addr) continue; - wifi_util_dbg_print(WIFI_CTRL,"%s:%d ifa-name : %s iface : %s\n", __func__, __LINE__, ifa->ifa_name, iface); + wifi_util_error_print(WIFI_CTRL,"%s:%d ifa-name : %s iface : %s\n", __func__, __LINE__, ifa->ifa_name, iface); if (strcmp(ifa->ifa_name, iface) != 0) continue; @@ -494,12 +494,13 @@ int process_udhcp_ip_check(vap_svc_t *svc) wifi_util_info_print(WIFI_CTRL, "%s:%d RF-Status value : %d\n", __func__, __LINE__, ctrl->rf_status_down); if (ctrl->rf_status_down == false) { + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); memset(value, '\0', sizeof(value)); memset(value, '\0', sizeof(file_name)); memset(command, '\0', sizeof(command)); interface_name = get_interface_name_for_vap_index(ext->connected_vap_index, svc->prop); if ((interface_name == NULL) && (ip_check_count < EXT_UDHCP_IP_CHECK_NUM)) { - wifi_util_dbg_print(WIFI_CTRL, + wifi_util_error_print(WIFI_CTRL, "%s:%d Unable to fetch proper Interface name for connected index%d\n", __func__, __LINE__, ext->connected_vap_index); ip_check_count++; @@ -509,15 +510,21 @@ int process_udhcp_ip_check(vap_svc_t *svc) snprintf(command, sizeof(command), "grep \"ip=\" %s | cut -d '=' -f 2", file_name); if ((ip_check_count < EXT_UDHCP_IP_CHECK_NUM) && (ext->conn_state == connection_state_connected)) { + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + if (access(file_name, F_OK) == 0) { fp = popen(command, "r"); if (fp != NULL) { + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + fgets(value, sizeof(value), fp); len = strlen(value); if (len > 0) { value[len - 1] = '\0'; if ((inet_pton(AF_INET, value, &(sa.sin_addr)) == 1) || (inet_pton(AF_INET6, value, &(sa.sin_addr)) == 1)) { + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + scheduler_cancel_timer_task(ctrl->sched, ext->ext_udhcp_ip_check_id); ext->ext_udhcp_ip_check_id = 0; ip_check_count = 0; @@ -534,15 +541,22 @@ int process_udhcp_ip_check(vap_svc_t *svc) (ext->conn_state == connection_state_connected)) { char iface[32] = "brww0"; if (has_valid_ip(iface)) { - wifi_util_info_print(WIFI_CTRL, "IGNTE_RF_DOWN: Received Valid IP address on brww0 interface\n"); + wifi_util_error_print(WIFI_CTRL, "IGNTE_RF_DOWN: Received Valid IP address on brww0 interface\n"); scheduler_cancel_timer_task(ctrl->sched, ext->ext_udhcp_ip_check_id); ext->ext_udhcp_ip_check_id = 0; ip_check_count = 0; return 0; } else { wifi_util_error_print(WIFI_CTRL, "IGNTE_RF_DOWN: Invalid IP address detected on brww0 interface\n"); + wifi_util_error_print(WIFI_CTRL, "IGNTE_RF_DOWN: Acting like nothing happened\n"); + scheduler_cancel_timer_task(ctrl->sched, ext->ext_udhcp_ip_check_id); + ext->ext_udhcp_ip_check_id = 0; + ip_check_count = 0; + return 0; } } + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + } if (ip_check_count >= EXT_UDHCP_IP_CHECK_NUM) { @@ -1716,6 +1730,8 @@ int process_ext_sta_conn_status(vap_svc_t *svc, void *arg) if ((ext->conn_state == connection_state_connection_in_progress) || (ext->conn_state == connection_state_connection_to_lcb_in_progress) || (ext->conn_state == connection_state_connection_to_nb_in_progress)) { + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + int radio_freq_band = 0; // copy the bss info to lcb memset(&ext->last_connected_bss, 0, sizeof(bss_candidate_t)); @@ -1727,17 +1743,19 @@ int process_ext_sta_conn_status(vap_svc_t *svc, void *arg) convert_radio_index_to_freq_band(svc->prop, index, &radio_freq_band); ext->last_connected_bss.radio_freq_band = (wifi_freq_bands_t)radio_freq_band; - wifi_util_dbg_print(WIFI_CTRL,"%s:%d - connected radio_band:%d\r\n", __func__, __LINE__, ext->last_connected_bss.radio_freq_band); + wifi_util_error_print(WIFI_CTRL,"%s:%d - connected radio_band:%d\r\n", __func__, __LINE__, ext->last_connected_bss.radio_freq_band); // copy the bss bssid info to global chache memcpy (temp_vap_info->u.sta_info.bssid, sta_data->bss_info.bssid, sizeof(temp_vap_info->u.sta_info.bssid)); // change the state ext_set_conn_state(ext, connection_state_connected, __func__, __LINE__); - if (ctrl->rf_status_down == true) { + if (ctrl->rf_status_down == true) { + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + char mac_str[32] = {'\0'}; uint8_mac_to_string_mac(temp_vap_info->u.sta_info.mac, mac_str); - wifi_util_dbg_print(WIFI_CTRL, + wifi_util_error_print(WIFI_CTRL, "%s:%d Bridge:%s Using MAC-Str:%s MAC : %02x:%02x:%02x:%02x:%02x:%02x\n", __func__, __LINE__, bridge_name, mac_str, temp_vap_info->u.sta_info.mac[0], temp_vap_info->u.sta_info.mac[1], temp_vap_info->u.sta_info.mac[2], @@ -1754,6 +1772,8 @@ int process_ext_sta_conn_status(vap_svc_t *svc, void *arg) "%s:%d Successfully set bridge MAC to %s\n", __func__, __LINE__, mac_str); } + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + snprintf(cmd, sizeof(cmd), "ip link set dev %s up", bridge_name); wifi_util_dbg_print(WIFI_CTRL,"%s:%d cmd : %s\n",__func__,__LINE__, cmd); get_stubs_descriptor()->v_secure_system_fn(cmd); @@ -1769,6 +1789,8 @@ int process_ext_sta_conn_status(vap_svc_t *svc, void *arg) if (ext->ext_udhcp_ip_check_id != 0) { scheduler_cancel_timer_task(ctrl->sched, ext->ext_udhcp_ip_check_id); + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + ext->ext_udhcp_ip_check_id = 0; } @@ -1783,6 +1805,8 @@ int process_ext_sta_conn_status(vap_svc_t *svc, void *arg) } if (ctrl->network_mode != rdk_dev_mode_type_em_node) { + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + scheduler_add_timer_task(ctrl->sched, FALSE, &ext->ext_udhcp_ip_check_id, process_udhcp_ip_check, svc, EXT_UDHCP_IP_CHECK_INTERVAL, EXT_UDHCP_IP_CHECK_NUM + 1, FALSE); @@ -1794,6 +1818,8 @@ int process_ext_sta_conn_status(vap_svc_t *svc, void *arg) radio_feat = (wifi_radio_feature_param_t *)get_wifidb_radio_feat_map(index); radio_params = (wifi_radio_operationParam_t *)get_wifidb_radio_map(index); if (radio_params != NULL) { + wifi_util_info_print(WIFI_CTRL,"%s:%d ---- \r\n",__func__, __LINE__); + if ((radio_params->channel != sta_data->stats.channel) || (radio_params->channelWidth != sta_data->stats.channelWidth)) { pthread_mutex_lock(&mgr->data_cache_lock); radio_params->channel = sta_data->stats.channel; diff --git a/source/core/wifi_ctrl_webconfig.c b/source/core/wifi_ctrl_webconfig.c index b0a809a55..e6f511730 100644 --- a/source/core/wifi_ctrl_webconfig.c +++ b/source/core/wifi_ctrl_webconfig.c @@ -3178,7 +3178,7 @@ void start_station_vaps(bool rf_status, const char *hotspotSsid, const char *hot } else { data->u.decoded.radios[radio_index] .vaps.vap_map.vap_array[vap_array_index] - .u.sta_info.security.mode = wifi_security_mode_wpa2_personal; //wpa2-psk, not radius + .u.sta_info.security.mode = wifi_security_mode_wpa_wpa2_personal; //wpa2-psk, not radius wifi_util_error_print(WIFI_WEBCONFIG, "%s: setting sec mode to wpa2-psk\n", __func__); } // set scanning period