diff --git a/agent/src/beerocks/slave/son_slave_thread.cpp b/agent/src/beerocks/slave/son_slave_thread.cpp index 25970d4a46..568cd6ad91 100644 --- a/agent/src/beerocks/slave/son_slave_thread.cpp +++ b/agent/src/beerocks/slave/son_slave_thread.cpp @@ -119,6 +119,17 @@ bool slave_thread::init() return false; } + if (config.ucc_listener_slave_hostap_iface == config.hostap_iface && + config.ucc_listener_port != 0) { + m_agent_ucc_listener = + std::make_unique(config.ucc_listener_port, config.vendor, + config.model, config.bridge_iface, &master_socket); + if (m_agent_ucc_listener && !m_agent_ucc_listener->start("ucc_listener")) { + LOG(ERROR) << "failed start agent_ucc_listener"; + return false; + } + } + return socket_thread::init(); } @@ -334,6 +345,20 @@ bool slave_thread::work() return true; } +void slave_thread::before_select() +{ + if (m_agent_ucc_listener) { + m_agent_ucc_listener->unlock(); + } +} + +void slave_thread::after_select(bool timeout) +{ + if (m_agent_ucc_listener) { + m_agent_ucc_listener->lock(); + } +} + void slave_thread::process_keep_alive() { if (!config.enable_keep_alive || !son_config.slave_keep_alive_retries) { diff --git a/agent/src/beerocks/slave/son_slave_thread.h b/agent/src/beerocks/slave/son_slave_thread.h index bb440b27cf..14155eddb7 100644 --- a/agent/src/beerocks/slave/son_slave_thread.h +++ b/agent/src/beerocks/slave/son_slave_thread.h @@ -9,6 +9,7 @@ #ifndef _SON_SLAVE_THREAD_H #define _SON_SLAVE_THREAD_H +#include "agent_ucc_listener.h" #include "ap_manager_thread.h" #include @@ -148,6 +149,9 @@ class slave_thread : public beerocks::socket_thread { void process_keep_alive(); + void before_select() override; + void after_select(bool timeout) override; + bool slave_fsm(bool &call_slave_select); void slave_reset(); void stop_slave_thread(); @@ -279,6 +283,8 @@ class slave_thread : public beerocks::socket_thread { uint8_t *m1_auth_buf = nullptr; size_t m1_auth_buf_len = 0; + std::unique_ptr m_agent_ucc_listener; + bool parse_intel_join_response(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx); bool parse_non_intel_join_response(Socket *sd); bool handle_autoconfiguration_wsc(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx);