aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt2013-03-18 12:54:41 -0500
committerDmitry Shmidt2013-03-18 12:54:41 -0500
commit1322b6c87443e3b0a9aef9f8a44a539923ba623e (patch)
tree7e9001accf0e94e583225f4ed63f1800eed4b19d
parent0b203ab4aacdb6e6dfb8c277aa290f0a02428e6f (diff)
downloadkernel-common-android-3.0.tar.gz
kernel-common-android-3.0.tar.xz
kernel-common-android-3.0.zip
net: wireless: bcmdhd: Fix p2p "linear" IE parsingandroid-3.0
Change-Id: Id9e358897529940eaaa6654f67297e1b77f52d15 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfgp2p.c40
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfgp2p.h3
2 files changed, 37 insertions, 6 deletions
diff --git a/drivers/net/wireless/bcmdhd/wl_cfgp2p.c b/drivers/net/wireless/bcmdhd/wl_cfgp2p.c
index 38c81cf94f4..8fcc13c4d30 100644
--- a/drivers/net/wireless/bcmdhd/wl_cfgp2p.c
+++ b/drivers/net/wireless/bcmdhd/wl_cfgp2p.c
@@ -1830,6 +1830,38 @@ wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id)
1830} 1830}
1831 1831
1832#define P2P_GROUP_CAPAB_GO_BIT 0x01 1832#define P2P_GROUP_CAPAB_GO_BIT 0x01
1833
1834u8*
1835wl_cfgp2p_find_attrib_in_all_p2p_Ies(u8 *parse, u32 len, u32 attrib)
1836{
1837 bcm_tlv_t *ie;
1838 u8* pAttrib;
1839
1840 CFGP2P_INFO(("Starting parsing parse %p attrib %d remaining len %d ", parse, attrib, len));
1841 while ((ie = bcm_parse_tlvs(parse, (int)len, DOT11_MNG_VS_ID))) {
1842 if (wl_cfgp2p_is_p2p_ie((uint8*)ie, &parse, &len) == TRUE) {
1843 /* Have the P2p ie. Now check for attribute */
1844 if ((pAttrib = wl_cfgp2p_retreive_p2pattrib(parse, attrib)) != NULL) {
1845 CFGP2P_INFO(("P2P attribute %d was found at parse %p",
1846 attrib, parse));
1847 return pAttrib;
1848 }
1849 else {
1850 parse += (ie->len + TLV_HDR_LEN);
1851 len -= (ie->len + TLV_HDR_LEN);
1852 CFGP2P_INFO(("P2P Attribute %d not found Moving parse"
1853 " to %p len to %d", attrib, parse, len));
1854 }
1855 }
1856 else {
1857 /* It was not p2p IE. parse will get updated automatically to next TLV */
1858 CFGP2P_INFO(("IT was NOT P2P IE parse %p len %d", parse, len));
1859 }
1860 }
1861 CFGP2P_ERR(("P2P attribute %d was NOT found", attrib));
1862 return NULL;
1863}
1864
1833u8 * 1865u8 *
1834wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length) 1866wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length)
1835{ 1867{
@@ -1838,12 +1870,8 @@ wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length)
1838 bool p2p_go = 0; 1870 bool p2p_go = 0;
1839 u8 *ptr = NULL; 1871 u8 *ptr = NULL;
1840 1872
1841 if (!(p2p_ie = wl_cfgp2p_find_p2pie(((u8 *) bi) + bi->ie_offset, bi->ie_length))) { 1873 if ((capability = wl_cfgp2p_find_attrib_in_all_p2p_Ies(((u8 *) bi) + bi->ie_offset,
1842 WL_ERR(("P2P IE not found")); 1874 bi->ie_length, P2P_SEID_P2P_INFO)) == NULL) {
1843 return NULL;
1844 }
1845
1846 if (!(capability = wl_cfgp2p_retreive_p2pattrib(p2p_ie, P2P_SEID_P2P_INFO))) {
1847 WL_ERR(("P2P Capability attribute not found")); 1875 WL_ERR(("P2P Capability attribute not found"));
1848 return NULL; 1876 return NULL;
1849 } 1877 }
diff --git a/drivers/net/wireless/bcmdhd/wl_cfgp2p.h b/drivers/net/wireless/bcmdhd/wl_cfgp2p.h
index 03a645aea31..be5ddba73a4 100644
--- a/drivers/net/wireless/bcmdhd/wl_cfgp2p.h
+++ b/drivers/net/wireless/bcmdhd/wl_cfgp2p.h
@@ -254,6 +254,9 @@ wl_cfgp2p_set_p2p_ps(struct wl_priv *wl, struct net_device *ndev, char* buf, int
254extern u8 * 254extern u8 *
255wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id); 255wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id);
256 256
257extern u8*
258wl_cfgp2p_find_attrib_in_all_p2p_Ies(u8 *parse, u32 len, u32 attrib);
259
257extern u8 * 260extern u8 *
258wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length); 261wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length);
259 262