]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/ap/ieee802_11_shared.c
WNM: Enable WNM-Sleep Mode configuration with hostapd SME/MLME
[thirdparty/hostap.git] / src / ap / ieee802_11_shared.c
index b3fdf3d6e5fa9efc4a9c3ea4020bd2cdb2827e94..9d07d651601032c6aeab8b9df29eb76fc5d1653c 100644 (file)
@@ -173,6 +173,8 @@ 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 == 0)
                return eid;
 
@@ -180,8 +182,14 @@ 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 */
+       pos++;
+
+       if (len < 4)
+               return pos;
        *pos = 0x00;
        if (hapd->conf->time_advertisement == 2)
                *pos |= 0x08; /* Bit 27 - UTC TSF Offset */