DPP: Cleaned up netrole indication for config object building
Include netrole as part of struct dpp_configuration to make config object building more flexible. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
e0d22c842a
commit
99918e069a
2 changed files with 27 additions and 5 deletions
|
@ -4372,6 +4372,7 @@ static int dpp_configuration_parse(struct dpp_authentication *auth,
|
||||||
conf_sta = dpp_configuration_alloc(pos + 10);
|
conf_sta = dpp_configuration_alloc(pos + 10);
|
||||||
if (!conf_sta)
|
if (!conf_sta)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
conf_sta->netrole = DPP_NETROLE_STA;
|
||||||
conf = conf_sta;
|
conf = conf_sta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4380,6 +4381,7 @@ static int dpp_configuration_parse(struct dpp_authentication *auth,
|
||||||
conf_ap = dpp_configuration_alloc(pos + 9);
|
conf_ap = dpp_configuration_alloc(pos + 9);
|
||||||
if (!conf_ap)
|
if (!conf_ap)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
conf_ap->netrole = DPP_NETROLE_AP;
|
||||||
conf = conf_ap;
|
conf = conf_ap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4646,8 +4648,21 @@ static void dpp_build_legacy_cred_params(struct wpabuf *buf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const char * dpp_netrole_str(enum dpp_netrole netrole)
|
||||||
|
{
|
||||||
|
switch (netrole) {
|
||||||
|
case DPP_NETROLE_STA:
|
||||||
|
return "sta";
|
||||||
|
case DPP_NETROLE_AP:
|
||||||
|
return "ap";
|
||||||
|
default:
|
||||||
|
return "??";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct wpabuf *
|
static struct wpabuf *
|
||||||
dpp_build_conf_obj_dpp(struct dpp_authentication *auth, int ap,
|
dpp_build_conf_obj_dpp(struct dpp_authentication *auth,
|
||||||
struct dpp_configuration *conf)
|
struct dpp_configuration *conf)
|
||||||
{
|
{
|
||||||
struct wpabuf *buf = NULL;
|
struct wpabuf *buf = NULL;
|
||||||
|
@ -4721,7 +4736,8 @@ dpp_build_conf_obj_dpp(struct dpp_authentication *auth, int ap,
|
||||||
#endif /* CONFIG_TESTING_OPTIONS */
|
#endif /* CONFIG_TESTING_OPTIONS */
|
||||||
wpabuf_printf(dppcon, "{\"groups\":[{\"groupId\":\"%s\",",
|
wpabuf_printf(dppcon, "{\"groups\":[{\"groupId\":\"%s\",",
|
||||||
conf->group_id ? conf->group_id : "*");
|
conf->group_id ? conf->group_id : "*");
|
||||||
wpabuf_printf(dppcon, "\"netRole\":\"%s\"}],", ap ? "ap" : "sta");
|
wpabuf_printf(dppcon, "\"netRole\":\"%s\"}],",
|
||||||
|
dpp_netrole_str(conf->netrole));
|
||||||
#ifdef CONFIG_TESTING_OPTIONS
|
#ifdef CONFIG_TESTING_OPTIONS
|
||||||
skip_groups:
|
skip_groups:
|
||||||
#endif /* CONFIG_TESTING_OPTIONS */
|
#endif /* CONFIG_TESTING_OPTIONS */
|
||||||
|
@ -4861,7 +4877,7 @@ fail:
|
||||||
|
|
||||||
|
|
||||||
static struct wpabuf *
|
static struct wpabuf *
|
||||||
dpp_build_conf_obj_legacy(struct dpp_authentication *auth, int ap,
|
dpp_build_conf_obj_legacy(struct dpp_authentication *auth,
|
||||||
struct dpp_configuration *conf)
|
struct dpp_configuration *conf)
|
||||||
{
|
{
|
||||||
struct wpabuf *buf;
|
struct wpabuf *buf;
|
||||||
|
@ -4903,8 +4919,8 @@ dpp_build_conf_obj(struct dpp_authentication *auth, int ap)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dpp_akm_dpp(conf->akm))
|
if (dpp_akm_dpp(conf->akm))
|
||||||
return dpp_build_conf_obj_dpp(auth, ap, conf);
|
return dpp_build_conf_obj_dpp(auth, conf);
|
||||||
return dpp_build_conf_obj_legacy(auth, ap, conf);
|
return dpp_build_conf_obj_legacy(auth, conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -161,10 +161,16 @@ enum dpp_akm {
|
||||||
DPP_AKM_PSK_SAE_DPP,
|
DPP_AKM_PSK_SAE_DPP,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum dpp_netrole {
|
||||||
|
DPP_NETROLE_STA,
|
||||||
|
DPP_NETROLE_AP,
|
||||||
|
};
|
||||||
|
|
||||||
struct dpp_configuration {
|
struct dpp_configuration {
|
||||||
u8 ssid[32];
|
u8 ssid[32];
|
||||||
size_t ssid_len;
|
size_t ssid_len;
|
||||||
enum dpp_akm akm;
|
enum dpp_akm akm;
|
||||||
|
enum dpp_netrole netrole;
|
||||||
|
|
||||||
/* For DPP configuration (connector) */
|
/* For DPP configuration (connector) */
|
||||||
os_time_t netaccesskey_expiry;
|
os_time_t netaccesskey_expiry;
|
||||||
|
|
Loading…
Reference in a new issue