]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add no_ctrl_interface config param to clear ctrl_interface
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 27 Sep 2013 20:30:20 +0000 (23:30 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 27 Sep 2013 20:34:35 +0000 (23:34 +0300)
This can be used to override previously set ctrl_interface value in a
way that clears the variable to NULL instead of empty string. The only
real use case for this is to disable per-interface ctrl_interface from
the additional control file (-I<file>) in case ctrl_interface was set in
the main configuration file. It should be noted that zero-length
ctrl_interface parameter can be used to initiate some control interface
backends, so simpler designs were not available for this.

The format of the new parameter is not exactly cleanest due to
configuration file parsing assumptions. For example:

ctrl_interface=....
no_ctrl_interface=

would end up with ctrl_interface=NULL.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/config.c
wpa_supplicant/ctrl_iface_unix.c

index 5ab11281e24b2605c14ecefb1349be4b1d9426b7..f7ce80211d9b582266c54f1682e93609ddea25d5 100644 (file)
@@ -3082,6 +3082,17 @@ static int wpa_config_process_ap_vendor_elements(
 }
 
 
+static int wpa_config_process_no_ctrl_interface(
+       const struct global_parse_data *data,
+       struct wpa_config *config, int line, const char *pos)
+{
+       wpa_printf(MSG_DEBUG, "no_ctrl_interface -> ctrl_interface=NULL");
+       os_free(config->ctrl_interface);
+       config->ctrl_interface = NULL;
+       return 0;
+}
+
+
 #ifdef OFFSET
 #undef OFFSET
 #endif /* OFFSET */
@@ -3101,6 +3112,7 @@ static int wpa_config_process_ap_vendor_elements(
 static const struct global_parse_data global_fields[] = {
 #ifdef CONFIG_CTRL_IFACE
        { STR(ctrl_interface), 0 },
+       { FUNC_NO_VAR(no_ctrl_interface), 0 },
        { STR(ctrl_interface_group), 0 } /* deprecated */,
 #endif /* CONFIG_CTRL_IFACE */
        { INT_RANGE(eapol_version, 1, 2), 0 },
index 8abf57d10a32837f015be273cb73add4812992e4..5fe9a4e438228396cbcaa954bec5169421c97075 100644 (file)
@@ -586,6 +586,8 @@ void wpa_supplicant_ctrl_iface_deinit(struct ctrl_iface_priv *priv)
                        os_free(fname);
                }
 
+               if (priv->wpa_s->conf->ctrl_interface == NULL)
+                       goto free_dst;
                buf = os_strdup(priv->wpa_s->conf->ctrl_interface);
                if (buf == NULL)
                        goto free_dst;