]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
TNC: Allow TNC to be enabled dynamically
authorJouni Malinen <j@w1.fi>
Fri, 16 May 2014 21:01:45 +0000 (00:01 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 17 May 2014 17:05:55 +0000 (20:05 +0300)
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>
src/ap/hostapd.c
src/eap_server/tncs.c

index 391d7746098741707710fbe10a77dc58c1e27ddd..b7e118c06adc40161af3222b318e2838efc25499 100644 (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);
index c0b82455ec859ec944188641f2662166ee3d1203..dc6f689c0b5eb56a3ba90eb1078f9d539d75f02a 100644 (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;