Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86184b93 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman
Browse files

staging: rtl8723au: rtw_restruct_wmm_ie23a(): Use cfg80211_find_vendor_ie()



Rewrite rtw_restruct_wmm_ie23a() using cfg80211_find_vendor_ie()

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2dcf6b4c
Loading
Loading
Loading
Loading
+13 −21
Original line number Diff line number Diff line
@@ -1911,31 +1911,23 @@ int rtw_set_key23a(struct rtw_adapter *adapter,
int rtw_restruct_wmm_ie23a(struct rtw_adapter *adapter, u8 *in_ie,
			   u8 *out_ie, uint in_len, uint initial_out_len)
{
	unsigned int ielength = 0;
	unsigned int i, j;
	int ielength;
	const u8 *p;

	i = 0; /* after the fixed IE */
	while (i < in_len) {
	ielength = initial_out_len;

		/* WMM element ID and OUI */
		if (in_ie[i] == 0xDD && in_ie[i + 2] == 0x00 &&
		    in_ie[i + 3] == 0x50 && in_ie[i + 4] == 0xF2 &&
		    in_ie[i + 5] == 0x02 && i+5 < in_len) {
	p = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
				    WLAN_OUI_TYPE_MICROSOFT_WMM,
				    in_ie, in_len);

			/* Append WMM IE to the last index of out_ie */
                        for (j = i; j < i + 9; j++) {
				out_ie[ielength] = in_ie[j];
				ielength++;
                        }
                        out_ie[initial_out_len + 1] = 0x07;
                        out_ie[initial_out_len + 6] = 0x00;
                        out_ie[initial_out_len + 8] = 0x00;
	if (p && p[1]) {
		memcpy(out_ie + initial_out_len, p, 9);

			break;
		}
		out_ie[initial_out_len + 1] = 7;
		out_ie[initial_out_len + 6] = 0;
		out_ie[initial_out_len + 8] = 0;

		i += (in_ie[i + 1] + 2); /*  to the next IE element */
		ielength += 9;
	}

	return ielength;