diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 391d77460..b7e118c06 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -14,6 +14,7 @@ #include "common/wpa_ctrl.h" #include "radius/radius_client.h" #include "radius/radius_das.h" +#include "eap_server/tncs.h" #include "hostapd.h" #include "authsrv.h" #include "sta_info.h" @@ -673,6 +674,13 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) wpa_printf(MSG_DEBUG, "%s(hapd=%p (%s), first=%d)", __func__, hapd, hapd->conf->iface, first); +#ifdef EAP_SERVER_TNC + if (hapd->conf->tnc && tncs_global_init() < 0) { + wpa_printf(MSG_ERROR, "Failed to initialize TNCS"); + return -1; + } +#endif /* EAP_SERVER_TNC */ + if (hapd->started) { wpa_printf(MSG_ERROR, "%s: Interface %s was already started", __func__, hapd->conf->iface); diff --git a/src/eap_server/tncs.c b/src/eap_server/tncs.c index c0b82455e..dc6f689c0 100644 --- a/src/eap_server/tncs.c +++ b/src/eap_server/tncs.c @@ -1115,6 +1115,9 @@ int tncs_global_init(void) { struct tnc_if_imv *imv; + if (tncs_global_data) + return 0; + tncs_global_data = os_zalloc(sizeof(*tncs_global_data)); if (tncs_global_data == NULL) return -1;