OSDN Git Service

Accumulative patch from commit dc013f1e37df3462085cf01a13f0c432f146ad7a
[android-x86/external-wpa_supplicant_8.git] / src / ap / ieee802_11_shared.c
index b3fdf3d..76f78a7 100644 (file)
@@ -173,6 +173,14 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
                len = 5;
        if (len < 4 && hapd->conf->interworking)
                len = 4;
+       if (len < 3 && hapd->conf->wnm_sleep_mode)
+               len = 3;
+       if (len < 7 && hapd->conf->ssid.utf8_ssid)
+               len = 7;
+#ifdef CONFIG_WNM
+       if (len < 4)
+               len = 4;
+#endif /* CONFIG_WNM */
        if (len == 0)
                return eid;
 
@@ -180,9 +188,20 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
        *pos++ = len;
        *pos++ = 0x00;
        *pos++ = 0x00;
-       *pos++ = 0x00;
 
        *pos = 0x00;
+       if (hapd->conf->wnm_sleep_mode)
+               *pos |= 0x02; /* Bit 17 - WNM-Sleep Mode */
+       if (hapd->conf->bss_transition)
+               *pos |= 0x08; /* Bit 19 - BSS Transition */
+       pos++;
+
+       if (len < 4)
+               return pos;
+       *pos = 0x00;
+#ifdef CONFIG_WNM
+       *pos |= 0x02; /* Bit 25 - SSID List */
+#endif /* CONFIG_WNM */
        if (hapd->conf->time_advertisement == 2)
                *pos |= 0x08; /* Bit 27 - UTC TSF Offset */
        if (hapd->conf->interworking)
@@ -198,6 +217,18 @@ u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
                *pos |= 0x80; /* Bit 39 - TDLS Channel Switching Prohibited */
        pos++;
 
+       if (len < 6)
+               return pos;
+       *pos = 0x00;
+       pos++;
+
+       if (len < 7)
+               return pos;
+       *pos = 0x00;
+       if (hapd->conf->ssid.utf8_ssid)
+               *pos |= 0x01; /* Bit 48 - UTF-8 SSID */
+       pos++;
+
        return pos;
 }