Use P2P_IE_VENDOR_TYPE more consistently

Previously, both this and combination of OUI_WFA and P2P_OUI_TYPE were
used. Using the full 32-bit value as a single operation saves a bit in
code size, so start moving towards using it more consistently when
writing or finding the P2P vendor specific element.

Signed-off-by: Rahul Jain <rahul.jain@samsung.com>
This commit is contained in:
Rahul Jain 2014-02-26 11:48:07 +05:30 committed by Jouni Malinen
parent 8714caa1c2
commit 8bc4372f37
5 changed files with 30 additions and 63 deletions

View file

@ -1660,20 +1660,15 @@ static void p2p_rx_action_public(struct p2p_data *p2p, const u8 *da,
case WLAN_PA_VENDOR_SPECIFIC:
data++;
len--;
if (len < 3)
if (len < 4)
return;
if (WPA_GET_BE24(data) != OUI_WFA)
if (WPA_GET_BE32(data) != P2P_IE_VENDOR_TYPE)
return;
data += 3;
len -= 3;
if (len < 1)
return;
data += 4;
len -= 4;
if (*data != P2P_OUI_TYPE)
return;
p2p_rx_p2p_action(p2p, sa, data + 1, len - 1, freq);
p2p_rx_p2p_action(p2p, sa, data, len, freq);
break;
case WLAN_PA_GAS_INITIAL_REQ:
p2p_rx_gas_initial_req(p2p, sa, data + 1, len - 1, freq);
@ -1706,15 +1701,10 @@ void p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa,
if (len < 4)
return;
if (WPA_GET_BE24(data) != OUI_WFA)
if (WPA_GET_BE32(data) != P2P_IE_VENDOR_TYPE)
return;
data += 3;
len -= 3;
if (*data != P2P_OUI_TYPE)
return;
data++;
len--;
data += 4;
len -= 4;
/* P2P action frame */
p2p_dbg(p2p, "RX P2P Action from " MACSTR, MAC2STR(sa));