From: Jouni Malinen Date: Fri, 16 May 2014 21:01:45 +0000 (+0300) Subject: TNC: Allow TNC to be enabled dynamically X-Git-Tag: hostap_2_2~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10b58b50297bd2a5c65b18663da02f472ac8f972;p=thirdparty%2Fhostap.git 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 --- 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;