Rename and fix ANQP definitions to match IEEE Std 802.11u-2011

This commit is contained in:
Jouni Malinen 2011-09-08 20:52:23 +03:00 committed by Jouni Malinen
parent 8a8c1c0ea5
commit daa30c23aa
2 changed files with 55 additions and 50 deletions

View file

@ -274,31 +274,33 @@
#define WLAN_TIMEOUT_KEY_LIFETIME 2 #define WLAN_TIMEOUT_KEY_LIFETIME 2
#define WLAN_TIMEOUT_ASSOC_COMEBACK 3 #define WLAN_TIMEOUT_ASSOC_COMEBACK 3
/* Advertisement Protocol ID definitions (IEEE 802.11u) */ /* Advertisement Protocol ID definitions (IEEE Std 802.11u-2011) */
enum adv_proto_id { enum adv_proto_id {
NATIVE_QUERY_PROTOCOL = 0, ACCESS_NETWORK_QUERY_PROTOCOL = 0,
MIH_INFO_SERVICE = 1, MIH_INFO_SERVICE = 1,
MIH_CMD_AND_EVENT_DISCOVERY = 2, MIH_CMD_AND_EVENT_DISCOVERY = 2,
EMERGENCY_ALERT_SYSTEM = 3, EMERGENCY_ALERT_SYSTEM = 3,
LOCATION_TO_SERVICE = 4,
ADV_PROTO_VENDOR_SPECIFIC = 221 ADV_PROTO_VENDOR_SPECIFIC = 221
}; };
/* Native Query Protocol info ID definitions (IEEE 802.11u) */ /* Access Network Query Protocol info ID definitions (IEEE Std 802.11u-2011) */
enum nqp_info_id { enum anqp_info_id {
NQP_CAPABILITY_LIST = 256, ANQP_QUERY_LIST = 256,
NQP_VENUE_NAME = 257, ANQP_CAPABILITY_LIST = 257,
NQP_EMERGENCY_CALL_NUMBER = 258, ANQP_VENUE_NAME = 258,
NQP_NETWORK_AUTH_TYPE = 259, ANQP_EMERGENCY_CALL_NUMBER = 259,
NQP_ROAMING_CONSORTIUM = 260, ANQP_NETWORK_AUTH_TYPE = 260,
NQP_IP_ADDR_TYPE_AVAILABILITY = 261, ANQP_ROAMING_CONSORTIUM = 261,
NQP_NAI_REALM = 262, ANQP_IP_ADDR_TYPE_AVAILABILITY = 262,
NQP_3GPP_CELLULAR_NETWORK = 263, ANQP_NAI_REALM = 263,
NQP_AP_GEOSPATIAL_LOCATION = 264, ANQP_3GPP_CELLULAR_NETWORK = 264,
NQP_AP_CIVIC_LOCATION = 265, ANQP_AP_GEOSPATIAL_LOCATION = 265,
NQP_DOMAIN_NAME = 266, ANQP_AP_CIVIC_LOCATION = 266,
NQP_EMERGENCY_ALERT_URI = 267, ANQP_AP_LOCATION_PUBLIC_URI = 267,
NQP_VENDOR_SPECIFIC = 56797 ANQP_DOMAIN_NAME = 268,
ANQP_EMERGENCY_ALERT_URI = 269,
ANQP_EMERGENCY_NAI = 271,
ANQP_VENDOR_SPECIFIC = 56797
}; };

View file

@ -104,13 +104,14 @@ static struct wpabuf * p2p_build_sd_query(u16 update_indic,
wpabuf_put_u8(buf, WLAN_EID_ADV_PROTO); wpabuf_put_u8(buf, WLAN_EID_ADV_PROTO);
wpabuf_put_u8(buf, 2); /* Length */ wpabuf_put_u8(buf, 2); /* Length */
wpabuf_put_u8(buf, 0); /* QueryRespLenLimit | PAME-BI */ wpabuf_put_u8(buf, 0); /* QueryRespLenLimit | PAME-BI */
wpabuf_put_u8(buf, NATIVE_QUERY_PROTOCOL); /* Advertisement Protocol */ /* Advertisement Protocol */
wpabuf_put_u8(buf, ACCESS_NETWORK_QUERY_PROTOCOL);
/* Query Request */ /* Query Request */
len_pos = wpabuf_put(buf, 2); /* Length (to be filled) */ len_pos = wpabuf_put(buf, 2); /* Length (to be filled) */
/* NQP Query Request Frame */ /* ANQP Query Request Frame */
wpabuf_put_le16(buf, NQP_VENDOR_SPECIFIC); /* Info ID */ wpabuf_put_le16(buf, ANQP_VENDOR_SPECIFIC); /* Info ID */
len_pos2 = wpabuf_put(buf, 2); /* Length (to be filled) */ len_pos2 = wpabuf_put(buf, 2); /* Length (to be filled) */
wpabuf_put_be24(buf, OUI_WFA); wpabuf_put_be24(buf, OUI_WFA);
wpabuf_put_u8(buf, P2P_OUI_TYPE); wpabuf_put_u8(buf, P2P_OUI_TYPE);
@ -181,14 +182,15 @@ static struct wpabuf * p2p_build_sd_response(u8 dialog_token, u16 status_code,
wpabuf_put_u8(buf, WLAN_EID_ADV_PROTO); wpabuf_put_u8(buf, WLAN_EID_ADV_PROTO);
wpabuf_put_u8(buf, 2); /* Length */ wpabuf_put_u8(buf, 2); /* Length */
wpabuf_put_u8(buf, 0x7f); /* QueryRespLenLimit | PAME-BI */ wpabuf_put_u8(buf, 0x7f); /* QueryRespLenLimit | PAME-BI */
wpabuf_put_u8(buf, NATIVE_QUERY_PROTOCOL); /* Advertisement Protocol */ /* Advertisement Protocol */
wpabuf_put_u8(buf, ACCESS_NETWORK_QUERY_PROTOCOL);
/* Query Response */ /* Query Response */
len_pos = wpabuf_put(buf, 2); /* Length (to be filled) */ len_pos = wpabuf_put(buf, 2); /* Length (to be filled) */
if (tlvs) { if (tlvs) {
/* NQP Query Response Frame */ /* ANQP Query Response Frame */
wpabuf_put_le16(buf, NQP_VENDOR_SPECIFIC); /* Info ID */ wpabuf_put_le16(buf, ANQP_VENDOR_SPECIFIC); /* Info ID */
len_pos2 = wpabuf_put(buf, 2); /* Length (to be filled) */ len_pos2 = wpabuf_put(buf, 2); /* Length (to be filled) */
wpabuf_put_be24(buf, OUI_WFA); wpabuf_put_be24(buf, OUI_WFA);
wpabuf_put_u8(buf, P2P_OUI_TYPE); wpabuf_put_u8(buf, P2P_OUI_TYPE);
@ -231,14 +233,15 @@ static struct wpabuf * p2p_build_gas_comeback_resp(u8 dialog_token,
wpabuf_put_u8(buf, WLAN_EID_ADV_PROTO); wpabuf_put_u8(buf, WLAN_EID_ADV_PROTO);
wpabuf_put_u8(buf, 2); /* Length */ wpabuf_put_u8(buf, 2); /* Length */
wpabuf_put_u8(buf, 0x7f); /* QueryRespLenLimit | PAME-BI */ wpabuf_put_u8(buf, 0x7f); /* QueryRespLenLimit | PAME-BI */
wpabuf_put_u8(buf, NATIVE_QUERY_PROTOCOL); /* Advertisement Protocol */ /* Advertisement Protocol */
wpabuf_put_u8(buf, ACCESS_NETWORK_QUERY_PROTOCOL);
/* Query Response */ /* Query Response */
len_pos = wpabuf_put(buf, 2); /* Length (to be filled) */ len_pos = wpabuf_put(buf, 2); /* Length (to be filled) */
if (frag_id == 0) { if (frag_id == 0) {
/* NQP Query Response Frame */ /* ANQP Query Response Frame */
wpabuf_put_le16(buf, NQP_VENDOR_SPECIFIC); /* Info ID */ wpabuf_put_le16(buf, ANQP_VENDOR_SPECIFIC); /* Info ID */
wpabuf_put_le16(buf, 3 + 1 + 2 + total_len); wpabuf_put_le16(buf, 3 + 1 + 2 + total_len);
wpabuf_put_be24(buf, OUI_WFA); wpabuf_put_be24(buf, OUI_WFA);
wpabuf_put_u8(buf, P2P_OUI_TYPE); wpabuf_put_u8(buf, P2P_OUI_TYPE);
@ -349,7 +352,7 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
} }
pos++; /* skip QueryRespLenLimit and PAME-BI */ pos++; /* skip QueryRespLenLimit and PAME-BI */
if (*pos != NATIVE_QUERY_PROTOCOL) { if (*pos != ACCESS_NETWORK_QUERY_PROTOCOL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported GAS advertisement protocol id %u", "P2P: Unsupported GAS advertisement protocol id %u",
*pos); *pos);
@ -366,12 +369,12 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
return; return;
end = pos + slen; end = pos + slen;
/* NQP Query Request */ /* ANQP Query Request */
if (pos + 4 > end) if (pos + 4 > end)
return; return;
if (WPA_GET_LE16(pos) != NQP_VENDOR_SPECIFIC) { if (WPA_GET_LE16(pos) != ANQP_VENDOR_SPECIFIC) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP Info ID %u", WPA_GET_LE16(pos)); "P2P: Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
return; return;
} }
pos += 2; pos += 2;
@ -380,20 +383,20 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
pos += 2; pos += 2;
if (pos + slen > end || slen < 3 + 1) { if (pos + slen > end || slen < 3 + 1) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid NQP Query Request length"); "P2P: Invalid ANQP Query Request length");
return; return;
} }
if (WPA_GET_BE24(pos) != OUI_WFA) { if (WPA_GET_BE24(pos) != OUI_WFA) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP OUI %06x", WPA_GET_BE24(pos)); "P2P: Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
return; return;
} }
pos += 3; pos += 3;
if (*pos != P2P_OUI_TYPE) { if (*pos != P2P_OUI_TYPE) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP vendor type %u", *pos); "P2P: Unsupported ANQP vendor type %u", *pos);
return; return;
} }
pos++; pos++;
@ -525,7 +528,7 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
} }
pos++; /* skip QueryRespLenLimit and PAME-BI */ pos++; /* skip QueryRespLenLimit and PAME-BI */
if (*pos != NATIVE_QUERY_PROTOCOL) { if (*pos != ACCESS_NETWORK_QUERY_PROTOCOL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported GAS advertisement protocol id %u", "P2P: Unsupported GAS advertisement protocol id %u",
*pos); *pos);
@ -563,12 +566,12 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
return; return;
} }
/* NQP Query Response */ /* ANQP Query Response */
if (pos + 4 > end) if (pos + 4 > end)
return; return;
if (WPA_GET_LE16(pos) != NQP_VENDOR_SPECIFIC) { if (WPA_GET_LE16(pos) != ANQP_VENDOR_SPECIFIC) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP Info ID %u", WPA_GET_LE16(pos)); "P2P: Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
return; return;
} }
pos += 2; pos += 2;
@ -577,20 +580,20 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
pos += 2; pos += 2;
if (pos + slen > end || slen < 3 + 1) { if (pos + slen > end || slen < 3 + 1) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid NQP Query Response length"); "P2P: Invalid ANQP Query Response length");
return; return;
} }
if (WPA_GET_BE24(pos) != OUI_WFA) { if (WPA_GET_BE24(pos) != OUI_WFA) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP OUI %06x", WPA_GET_BE24(pos)); "P2P: Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
return; return;
} }
pos += 3; pos += 3;
if (*pos != P2P_OUI_TYPE) { if (*pos != P2P_OUI_TYPE) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP vendor type %u", *pos); "P2P: Unsupported ANQP vendor type %u", *pos);
return; return;
} }
pos++; pos++;
@ -772,7 +775,7 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
} }
pos++; /* skip QueryRespLenLimit and PAME-BI */ pos++; /* skip QueryRespLenLimit and PAME-BI */
if (*pos != NATIVE_QUERY_PROTOCOL) { if (*pos != ACCESS_NETWORK_QUERY_PROTOCOL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported GAS advertisement protocol id %u", "P2P: Unsupported GAS advertisement protocol id %u",
*pos); *pos);
@ -804,29 +807,29 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
if (p2p->sd_rx_resp) { if (p2p->sd_rx_resp) {
/* /*
* NQP header is only included in the first fragment; rest of * ANQP header is only included in the first fragment; rest of
* the fragments start with continue TLVs. * the fragments start with continue TLVs.
*/ */
goto skip_nqp_header; goto skip_nqp_header;
} }
/* NQP Query Response */ /* ANQP Query Response */
if (pos + 4 > end) if (pos + 4 > end)
return; return;
if (WPA_GET_LE16(pos) != NQP_VENDOR_SPECIFIC) { if (WPA_GET_LE16(pos) != ANQP_VENDOR_SPECIFIC) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP Info ID %u", WPA_GET_LE16(pos)); "P2P: Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
return; return;
} }
pos += 2; pos += 2;
slen = WPA_GET_LE16(pos); slen = WPA_GET_LE16(pos);
pos += 2; pos += 2;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: NQP Query Response " wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: ANQP Query Response "
"length: %u", slen); "length: %u", slen);
if (slen < 3 + 1) { if (slen < 3 + 1) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid NQP Query Response length"); "P2P: Invalid ANQP Query Response length");
return; return;
} }
if (pos + 4 > end) if (pos + 4 > end)
@ -834,14 +837,14 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
if (WPA_GET_BE24(pos) != OUI_WFA) { if (WPA_GET_BE24(pos) != OUI_WFA) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP OUI %06x", WPA_GET_BE24(pos)); "P2P: Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
return; return;
} }
pos += 3; pos += 3;
if (*pos != P2P_OUI_TYPE) { if (*pos != P2P_OUI_TYPE) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported NQP vendor type %u", *pos); "P2P: Unsupported ANQP vendor type %u", *pos);
return; return;
} }
pos++; pos++;