Add no_ctrl_interface config param to clear ctrl_interface

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>
This commit is contained in:
Jouni Malinen 2013-09-27 23:30:20 +03:00 committed by Jouni Malinen
parent 25b65a142d
commit ea61aa1de1
2 changed files with 14 additions and 0 deletions

View 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 },

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