wpa_supplicant: Add a configuration file for the P2P_DEVICE parameters
Add an option to specify a configuration file that can be used to hold the P2P_DEVICE configuration parameters. If this option is not used, the P2P_DEVICE configuration parameters will be read from interface configuration file. Note that it is advised to use this option in some cases such as: If a P2P_DEVICE is supported by the driver, the wpa_supplicant creates a dedicated P2P Device interface, where the configuration file used for the main interface is used. As a consequence, if the configuration file includes network definition etc., the wpa_supplicant will try to perform station specific flows on the P2P Device interface which will fail. If a P2P_DEVICE is supported by the driver and update_config is used, the P2P Device configuration data will override the main interface configuration data. Signed-hostap: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
185677b74c
commit
c16a7590cf
5 changed files with 54 additions and 3 deletions
|
@ -413,7 +413,7 @@ usage:
|
||||||
[-G<group>] \
|
[-G<group>] \
|
||||||
-i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
|
-i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
|
||||||
[-b<br_ifname> [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
|
[-b<br_ifname> [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
|
||||||
[-p<driver_param>] [-b<br_ifname>] ...]
|
[-p<driver_param>] [-b<br_ifname>] [-m<P2P Device config file>] ...
|
||||||
|
|
||||||
options:
|
options:
|
||||||
-b = optional bridge interface name
|
-b = optional bridge interface name
|
||||||
|
@ -438,6 +438,7 @@ options:
|
||||||
-w = wait for interface to be added, if needed
|
-w = wait for interface to be added, if needed
|
||||||
-W = wait for a control interface monitor before starting
|
-W = wait for a control interface monitor before starting
|
||||||
-N = start describing new interface
|
-N = start describing new interface
|
||||||
|
-m = Configuration file for the P2P Device
|
||||||
|
|
||||||
drivers:
|
drivers:
|
||||||
nl80211 = Linux nl80211/cfg80211
|
nl80211 = Linux nl80211/cfg80211
|
||||||
|
|
|
@ -43,6 +43,9 @@ static void usage(void)
|
||||||
" [-o<override driver>] [-O<override ctrl>] \\\n"
|
" [-o<override driver>] [-O<override ctrl>] \\\n"
|
||||||
" [-N -i<ifname> -c<conf> [-C<ctrl>] "
|
" [-N -i<ifname> -c<conf> [-C<ctrl>] "
|
||||||
"[-D<driver>] \\\n"
|
"[-D<driver>] \\\n"
|
||||||
|
#ifdef CONFIG_P2P
|
||||||
|
" [-m<P2P Device config file>] \\\n"
|
||||||
|
#endif /* CONFIG_P2P */
|
||||||
" [-p<driver_param>] [-b<br_ifname>] [-I<config file>] "
|
" [-p<driver_param>] [-b<br_ifname>] [-I<config file>] "
|
||||||
"...]\n"
|
"...]\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -92,6 +95,9 @@ static void usage(void)
|
||||||
#endif /* CONFIG_DBUS */
|
#endif /* CONFIG_DBUS */
|
||||||
printf(" -v = show version\n"
|
printf(" -v = show version\n"
|
||||||
" -W = wait for a control interface monitor before starting\n"
|
" -W = wait for a control interface monitor before starting\n"
|
||||||
|
#ifdef CONFIG_P2P
|
||||||
|
" -m = Configuration file for the P2P Device interface\n"
|
||||||
|
#endif /* CONFIG_P2P */
|
||||||
" -N = start describing new interface\n");
|
" -N = start describing new interface\n");
|
||||||
|
|
||||||
printf("example:\n"
|
printf("example:\n"
|
||||||
|
@ -169,7 +175,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = getopt(argc, argv,
|
c = getopt(argc, argv,
|
||||||
"b:Bc:C:D:de:f:g:G:hi:I:KLNo:O:p:P:qsTtuvW");
|
"b:Bc:C:D:de:f:g:G:hi:I:KLm:No:O:p:P:qsTtuvW");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -229,6 +235,11 @@ int main(int argc, char *argv[])
|
||||||
license();
|
license();
|
||||||
exitcode = 0;
|
exitcode = 0;
|
||||||
goto out;
|
goto out;
|
||||||
|
#ifdef CONFIG_P2P
|
||||||
|
case 'm':
|
||||||
|
iface->conf_p2p_dev = optarg;
|
||||||
|
break;
|
||||||
|
#endif /* CONFIG_P2P */
|
||||||
case 'o':
|
case 'o':
|
||||||
params.override_driver = optarg;
|
params.override_driver = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3680,7 +3680,20 @@ int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s)
|
||||||
iface.ifname = wpa_s->pending_interface_name;
|
iface.ifname = wpa_s->pending_interface_name;
|
||||||
iface.driver = wpa_s->driver->name;
|
iface.driver = wpa_s->driver->name;
|
||||||
iface.driver_param = wpa_s->conf->driver_param;
|
iface.driver_param = wpa_s->conf->driver_param;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a P2P Device configuration file was given, use it as the interface
|
||||||
|
* configuration file (instead of using parent's configuration file.
|
||||||
|
*/
|
||||||
|
if (wpa_s->conf_p2p_dev) {
|
||||||
|
iface.confname = wpa_s->conf_p2p_dev;
|
||||||
|
iface.ctrl_interface = NULL;
|
||||||
|
} else {
|
||||||
iface.confname = wpa_s->confname;
|
iface.confname = wpa_s->confname;
|
||||||
|
iface.ctrl_interface = wpa_s->conf->ctrl_interface;
|
||||||
|
}
|
||||||
|
iface.conf_p2p_dev = NULL;
|
||||||
|
|
||||||
p2pdev_wpa_s = wpa_supplicant_add_iface(wpa_s->global, &iface);
|
p2pdev_wpa_s = wpa_supplicant_add_iface(wpa_s->global, &iface);
|
||||||
if (!p2pdev_wpa_s) {
|
if (!p2pdev_wpa_s) {
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Failed to add P2P Device interface");
|
wpa_printf(MSG_DEBUG, "P2P: Failed to add P2P Device interface");
|
||||||
|
|
|
@ -397,6 +397,11 @@ 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;
|
||||||
|
@ -3382,6 +3387,11 @@ 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.
|
||||||
|
|
|
@ -64,6 +64,17 @@ struct wpa_interface {
|
||||||
*/
|
*/
|
||||||
const char *confanother;
|
const char *confanother;
|
||||||
|
|
||||||
|
#ifdef CONFIG_P2P
|
||||||
|
/**
|
||||||
|
* conf_p2p_dev - Additional configuration file used to hold the
|
||||||
|
* P2P Device configuration parameters.
|
||||||
|
*
|
||||||
|
* This can also be %NULL. In such a case, if a P2P Device dedicated
|
||||||
|
* interfaces is created, the main configuration file will be used.
|
||||||
|
*/
|
||||||
|
const char *conf_p2p_dev;
|
||||||
|
#endif /* CONFIG_P2P */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ctrl_interface - Control interface parameter
|
* ctrl_interface - Control interface parameter
|
||||||
*
|
*
|
||||||
|
@ -386,6 +397,11 @@ 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;
|
||||||
|
|
Loading…
Reference in a new issue