P2P: Use only the -m config for P2P management device

Previously, the case of non-netdev P2P management device ended up
pulling in both the main interface (e.g., wlan0) and P2P Device
interface (from command line -m argument) as configuration. Similarly,
the main interface ended up included both configuration files. This is
not really helpful for various use cases, e.g., when permanent P2P group
information is stored in the P2P Devince interface, but it gets
duplicated in the main station interface configuration.

Clean this up by changing the -m<file> argument to replace, not
concatenate, configuration information. In other words, the main station
interface will not read this configuration and the P2P Device interface
(non-netdev) does not read parameters from the station interface
configuration file.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-10-03 22:50:21 +03:00 committed by Jouni Malinen
parent c4a8c173b8
commit f1a613118e
5 changed files with 9 additions and 20 deletions

View file

@ -331,7 +331,8 @@ int main(int argc, char *argv[])
if (wpa_s->global->p2p == NULL && if (wpa_s->global->p2p == NULL &&
(wpa_s->drv_flags & (wpa_s->drv_flags &
WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE) && WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE) &&
wpas_p2p_add_p2pdev_interface(wpa_s) < 0) wpas_p2p_add_p2pdev_interface(wpa_s, iface->conf_p2p_dev) <
0)
exitcode = -1; exitcode = -1;
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
} }

View file

@ -3786,7 +3786,8 @@ static void wpas_p2p_debug_print(void *ctx, int level, const char *msg)
} }
int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s) int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s,
const char *conf_p2p_dev)
{ {
struct wpa_interface iface; struct wpa_interface iface;
struct wpa_supplicant *p2pdev_wpa_s; struct wpa_supplicant *p2pdev_wpa_s;
@ -3817,8 +3818,8 @@ int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s)
* If a P2P Device configuration file was given, use it as the interface * If a P2P Device configuration file was given, use it as the interface
* configuration file (instead of using parent's configuration file. * configuration file (instead of using parent's configuration file.
*/ */
if (wpa_s->conf_p2p_dev) { if (conf_p2p_dev) {
iface.confname = wpa_s->conf_p2p_dev; iface.confname = conf_p2p_dev;
iface.ctrl_interface = NULL; iface.ctrl_interface = NULL;
} else { } else {
iface.confname = wpa_s->confname; iface.confname = wpa_s->confname;

View file

@ -16,7 +16,8 @@ struct p2p_peer_info;
struct p2p_channels; struct p2p_channels;
struct wps_event_fail; struct wps_event_fail;
int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s); int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s,
const char *conf_p2p_dev);
struct wpa_supplicant * wpas_get_p2p_go_iface(struct wpa_supplicant *wpa_s, struct wpa_supplicant * wpas_get_p2p_go_iface(struct wpa_supplicant *wpa_s,
const u8 *ssid, size_t ssid_len); const u8 *ssid, size_t ssid_len);
struct wpa_supplicant * wpas_get_p2p_client_iface(struct wpa_supplicant *wpa_s, struct wpa_supplicant * wpas_get_p2p_client_iface(struct wpa_supplicant *wpa_s,

View file

@ -403,11 +403,6 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
os_free(wpa_s->confanother); os_free(wpa_s->confanother);
wpa_s->confanother = NULL; wpa_s->confanother = NULL;
#ifdef CONFIG_P2P
os_free(wpa_s->conf_p2p_dev);
wpa_s->conf_p2p_dev = NULL;
#endif /* CONFIG_P2P */
wpa_sm_set_eapol(wpa_s->wpa, NULL); wpa_sm_set_eapol(wpa_s->wpa, NULL);
eapol_sm_deinit(wpa_s->eapol); eapol_sm_deinit(wpa_s->eapol);
wpa_s->eapol = NULL; wpa_s->eapol = NULL;
@ -3653,11 +3648,6 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
wpa_s->confanother = os_rel2abs_path(iface->confanother); wpa_s->confanother = os_rel2abs_path(iface->confanother);
wpa_config_read(wpa_s->confanother, wpa_s->conf); wpa_config_read(wpa_s->confanother, wpa_s->conf);
#ifdef CONFIG_P2P
wpa_s->conf_p2p_dev = os_rel2abs_path(iface->conf_p2p_dev);
wpa_config_read(wpa_s->conf_p2p_dev, wpa_s->conf);
#endif /* CONFIG_P2P */
/* /*
* Override ctrl_interface and driver_param if set on command * Override ctrl_interface and driver_param if set on command
* line. * line.

View file

@ -67,7 +67,7 @@ struct wpa_interface {
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
/** /**
* conf_p2p_dev - Additional configuration file used to hold the * conf_p2p_dev - Configuration file used to hold the
* P2P Device configuration parameters. * P2P Device configuration parameters.
* *
* This can also be %NULL. In such a case, if a P2P Device dedicated * This can also be %NULL. In such a case, if a P2P Device dedicated
@ -408,10 +408,6 @@ struct wpa_supplicant {
char *confname; char *confname;
char *confanother; char *confanother;
#ifdef CONFIG_P2P
char *conf_p2p_dev;
#endif /* CONFIG_P2P */
struct wpa_config *conf; struct wpa_config *conf;
int countermeasures; int countermeasures;
struct os_reltime last_michael_mic_error; struct os_reltime last_michael_mic_error;