DPP: Event message for indicating when Relay would need a Controller

The new DPP-RELAY-NEEDS-CONTROLLER control interface event can be used
to trigger mDNS discovery of a Controller to see if such a connection
can be established automatically at the time an Enrollee is trying to
initiate an operation.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-07-23 22:42:24 +03:00 committed by Jouni Malinen
parent ca7892e98f
commit d22dfe9187
3 changed files with 33 additions and 1 deletions

View file

@ -1001,6 +1001,27 @@ void hostapd_dpp_listen_stop(struct hostapd_data *hapd)
} }
#ifdef CONFIG_DPP2
static void
hostapd_dpp_relay_needs_controller(struct hostapd_data *hapd, const u8 *src,
enum dpp_public_action_frame_type type)
{
struct os_reltime now;
if (!hapd->conf->dpp_relay_port)
return;
os_get_reltime(&now);
if (hapd->dpp_relay_last_needs_ctrl.sec &&
!os_reltime_expired(&now, &hapd->dpp_relay_last_needs_ctrl, 60))
return;
hapd->dpp_relay_last_needs_ctrl = now;
wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_RELAY_NEEDS_CONTROLLER
MACSTR " %u", MAC2STR(src), type);
}
#endif /* CONFIG_DPP2 */
static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src, static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src,
const u8 *hdr, const u8 *buf, size_t len, const u8 *hdr, const u8 *buf, size_t len,
unsigned int freq) unsigned int freq)
@ -1049,6 +1070,8 @@ static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src,
src, hdr, buf, len, freq, i_bootstrap, src, hdr, buf, len, freq, i_bootstrap,
r_bootstrap, hapd) == 0) r_bootstrap, hapd) == 0)
return; return;
hostapd_dpp_relay_needs_controller(hapd, src,
DPP_PA_AUTHENTICATION_REQ);
} }
#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP2 */
if (!own_bi) { if (!own_bi) {
@ -1668,6 +1691,8 @@ hostapd_dpp_rx_presence_announcement(struct hostapd_data *hapd, const u8 *src,
return; return;
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"DPP: No matching bootstrapping information found"); "DPP: No matching bootstrapping information found");
hostapd_dpp_relay_needs_controller(
hapd, src, DPP_PA_PRESENCE_ANNOUNCEMENT);
return; return;
} }
@ -1758,6 +1783,8 @@ hostapd_dpp_rx_reconfig_announcement(struct hostapd_data *hapd, const u8 *src,
return; return;
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"DPP: No matching Configurator information found"); "DPP: No matching Configurator information found");
hostapd_dpp_relay_needs_controller(
hapd, src, DPP_PA_RECONFIG_ANNOUNCEMENT);
return; return;
} }
@ -2198,9 +2225,12 @@ try_relay:
#ifdef CONFIG_DPP2 #ifdef CONFIG_DPP2
if (v2 && dpp_relay_rx_action(hapd->iface->interfaces->dpp, if (v2 && dpp_relay_rx_action(hapd->iface->interfaces->dpp,
src, hdr, buf, len, freq, NULL, NULL, src, hdr, buf, len, freq, NULL, NULL,
hapd) != 0) hapd) != 0) {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"DPP: No Relay available for the message"); "DPP: No Relay available for the message");
hostapd_dpp_relay_needs_controller(hapd, src,
DPP_PA_PKEX_EXCHANGE_REQ);
}
#else /* CONFIG_DPP2 */ #else /* CONFIG_DPP2 */
wpa_printf(MSG_DEBUG, "DPP: No relay functionality included - skip"); wpa_printf(MSG_DEBUG, "DPP: No relay functionality included - skip");
#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP2 */

View file

@ -433,6 +433,7 @@ struct hostapd_data {
int dpp_chirp_round; int dpp_chirp_round;
int dpp_chirp_scan_done; int dpp_chirp_scan_done;
int dpp_chirp_listen; int dpp_chirp_listen;
struct os_reltime dpp_relay_last_needs_ctrl;
#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP2 */
#ifdef CONFIG_TESTING_OPTIONS #ifdef CONFIG_TESTING_OPTIONS
char *dpp_config_obj_override; char *dpp_config_obj_override;

View file

@ -215,6 +215,7 @@ extern "C" {
#define DPP_EVENT_CONF_NEEDED "DPP-CONF-NEEDED " #define DPP_EVENT_CONF_NEEDED "DPP-CONF-NEEDED "
#define DPP_EVENT_PB_STATUS "DPP-PB-STATUS " #define DPP_EVENT_PB_STATUS "DPP-PB-STATUS "
#define DPP_EVENT_PB_RESULT "DPP-PB-RESULT " #define DPP_EVENT_PB_RESULT "DPP-PB-RESULT "
#define DPP_EVENT_RELAY_NEEDS_CONTROLLER "DPP-RELAY-NEEDS-CONTROLLER "
/* MESH events */ /* MESH events */
#define MESH_GROUP_STARTED "MESH-GROUP-STARTED " #define MESH_GROUP_STARTED "MESH-GROUP-STARTED "