TNC: Allow TNC to be enabled dynamically

Previously, hostapd had to be started with at least one of the
configuration files enabling TNC for TNC to be usable. Change this to
allow TNC to be enabled when the first interface with TNC enabled gets
added during runtime.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-05-17 00:01:45 +03:00
parent 0a626a5060
commit 10b58b5029
2 changed files with 11 additions and 0 deletions

View File

@ -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);

View File

@ -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;