LCOV - code coverage report
Current view: top level - src/ap - ieee802_11_shared.c (source / functions) Hit Total Coverage
Test: wpa_supplicant/hostapd combined for hwsim test run 1401264779 Lines: 246 280 87.9 %
Date: 2014-05-28 Functions: 14 14 100.0 %

          Line data    Source code
       1             : /*
       2             :  * hostapd / IEEE 802.11 Management
       3             :  * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
       4             :  *
       5             :  * This software may be distributed under the terms of the BSD license.
       6             :  * See README for more details.
       7             :  */
       8             : 
       9             : #include "utils/includes.h"
      10             : 
      11             : #include "utils/common.h"
      12             : #include "common/ieee802_11_defs.h"
      13             : #include "hostapd.h"
      14             : #include "sta_info.h"
      15             : #include "ap_config.h"
      16             : #include "ap_drv_ops.h"
      17             : #include "ieee802_11.h"
      18             : 
      19             : 
      20             : #ifdef CONFIG_IEEE80211W
      21             : 
      22           2 : u8 * hostapd_eid_assoc_comeback_time(struct hostapd_data *hapd,
      23             :                                      struct sta_info *sta, u8 *eid)
      24             : {
      25           2 :         u8 *pos = eid;
      26             :         u32 timeout, tu;
      27             :         struct os_reltime now, passed;
      28             : 
      29           2 :         *pos++ = WLAN_EID_TIMEOUT_INTERVAL;
      30           2 :         *pos++ = 5;
      31           2 :         *pos++ = WLAN_TIMEOUT_ASSOC_COMEBACK;
      32           2 :         os_get_reltime(&now);
      33           2 :         os_reltime_sub(&now, &sta->sa_query_start, &passed);
      34           2 :         tu = (passed.sec * 1000000 + passed.usec) / 1024;
      35           2 :         if (hapd->conf->assoc_sa_query_max_timeout > tu)
      36           2 :                 timeout = hapd->conf->assoc_sa_query_max_timeout - tu;
      37             :         else
      38           0 :                 timeout = 0;
      39           2 :         if (timeout < hapd->conf->assoc_sa_query_max_timeout)
      40           2 :                 timeout++; /* add some extra time for local timers */
      41           2 :         WPA_PUT_LE32(pos, timeout);
      42           2 :         pos += 4;
      43             : 
      44           2 :         return pos;
      45             : }
      46             : 
      47             : 
      48             : /* MLME-SAQuery.request */
      49          12 : void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
      50             :                                   const u8 *addr, const u8 *trans_id)
      51             : {
      52             :         struct ieee80211_mgmt mgmt;
      53             :         u8 *end;
      54             : 
      55          72 :         wpa_printf(MSG_DEBUG, "IEEE 802.11: Sending SA Query Request to "
      56          72 :                    MACSTR, MAC2STR(addr));
      57          12 :         wpa_hexdump(MSG_DEBUG, "IEEE 802.11: SA Query Transaction ID",
      58             :                     trans_id, WLAN_SA_QUERY_TR_ID_LEN);
      59             : 
      60          12 :         os_memset(&mgmt, 0, sizeof(mgmt));
      61          12 :         mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
      62             :                                           WLAN_FC_STYPE_ACTION);
      63          12 :         os_memcpy(mgmt.da, addr, ETH_ALEN);
      64          12 :         os_memcpy(mgmt.sa, hapd->own_addr, ETH_ALEN);
      65          12 :         os_memcpy(mgmt.bssid, hapd->own_addr, ETH_ALEN);
      66          12 :         mgmt.u.action.category = WLAN_ACTION_SA_QUERY;
      67          12 :         mgmt.u.action.u.sa_query_req.action = WLAN_SA_QUERY_REQUEST;
      68          12 :         os_memcpy(mgmt.u.action.u.sa_query_req.trans_id, trans_id,
      69             :                   WLAN_SA_QUERY_TR_ID_LEN);
      70          12 :         end = mgmt.u.action.u.sa_query_req.trans_id + WLAN_SA_QUERY_TR_ID_LEN;
      71          12 :         if (hostapd_drv_send_mlme(hapd, &mgmt, end - (u8 *) &mgmt, 0) < 0)
      72           0 :                 wpa_printf(MSG_INFO, "ieee802_11_send_sa_query_req: send failed");
      73          12 : }
      74             : 
      75             : 
      76           1 : static void ieee802_11_send_sa_query_resp(struct hostapd_data *hapd,
      77             :                                           const u8 *sa, const u8 *trans_id)
      78             : {
      79             :         struct sta_info *sta;
      80             :         struct ieee80211_mgmt resp;
      81             :         u8 *end;
      82             : 
      83           6 :         wpa_printf(MSG_DEBUG, "IEEE 802.11: Received SA Query Request from "
      84           6 :                    MACSTR, MAC2STR(sa));
      85           1 :         wpa_hexdump(MSG_DEBUG, "IEEE 802.11: SA Query Transaction ID",
      86             :                     trans_id, WLAN_SA_QUERY_TR_ID_LEN);
      87             : 
      88           1 :         sta = ap_get_sta(hapd, sa);
      89           1 :         if (sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) {
      90           0 :                 wpa_printf(MSG_DEBUG, "IEEE 802.11: Ignore SA Query Request "
      91           0 :                            "from unassociated STA " MACSTR, MAC2STR(sa));
      92           1 :                 return;
      93             :         }
      94             : 
      95           6 :         wpa_printf(MSG_DEBUG, "IEEE 802.11: Sending SA Query Response to "
      96           6 :                    MACSTR, MAC2STR(sa));
      97             : 
      98           1 :         os_memset(&resp, 0, sizeof(resp));
      99           1 :         resp.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
     100             :                                           WLAN_FC_STYPE_ACTION);
     101           1 :         os_memcpy(resp.da, sa, ETH_ALEN);
     102           1 :         os_memcpy(resp.sa, hapd->own_addr, ETH_ALEN);
     103           1 :         os_memcpy(resp.bssid, hapd->own_addr, ETH_ALEN);
     104           1 :         resp.u.action.category = WLAN_ACTION_SA_QUERY;
     105           1 :         resp.u.action.u.sa_query_req.action = WLAN_SA_QUERY_RESPONSE;
     106           1 :         os_memcpy(resp.u.action.u.sa_query_req.trans_id, trans_id,
     107             :                   WLAN_SA_QUERY_TR_ID_LEN);
     108           1 :         end = resp.u.action.u.sa_query_req.trans_id + WLAN_SA_QUERY_TR_ID_LEN;
     109           1 :         if (hostapd_drv_send_mlme(hapd, &resp, end - (u8 *) &resp, 0) < 0)
     110           0 :                 wpa_printf(MSG_INFO, "ieee80211_mgmt_sa_query_request: send failed");
     111             : }
     112             : 
     113             : 
     114           3 : void ieee802_11_sa_query_action(struct hostapd_data *hapd, const u8 *sa,
     115             :                                 const u8 action_type, const u8 *trans_id)
     116             : {
     117             :         struct sta_info *sta;
     118             :         int i;
     119             : 
     120           3 :         if (action_type == WLAN_SA_QUERY_REQUEST) {
     121           1 :                 ieee802_11_send_sa_query_resp(hapd, sa, trans_id);
     122           1 :                 return;
     123             :         }
     124             : 
     125           2 :         if (action_type != WLAN_SA_QUERY_RESPONSE) {
     126           0 :                 wpa_printf(MSG_DEBUG, "IEEE 802.11: Unexpected SA Query "
     127             :                            "Action %d", action_type);
     128           0 :                 return;
     129             :         }
     130             : 
     131          12 :         wpa_printf(MSG_DEBUG, "IEEE 802.11: Received SA Query Response from "
     132          12 :                    MACSTR, MAC2STR(sa));
     133           2 :         wpa_hexdump(MSG_DEBUG, "IEEE 802.11: SA Query Transaction ID",
     134             :                     trans_id, WLAN_SA_QUERY_TR_ID_LEN);
     135             : 
     136             :         /* MLME-SAQuery.confirm */
     137             : 
     138           2 :         sta = ap_get_sta(hapd, sa);
     139           2 :         if (sta == NULL || sta->sa_query_trans_id == NULL) {
     140           2 :                 wpa_printf(MSG_DEBUG, "IEEE 802.11: No matching STA with "
     141             :                            "pending SA Query request found");
     142           2 :                 return;
     143             :         }
     144             : 
     145           0 :         for (i = 0; i < sta->sa_query_count; i++) {
     146           0 :                 if (os_memcmp(sta->sa_query_trans_id +
     147             :                               i * WLAN_SA_QUERY_TR_ID_LEN,
     148             :                               trans_id, WLAN_SA_QUERY_TR_ID_LEN) == 0)
     149           0 :                         break;
     150             :         }
     151             : 
     152           0 :         if (i >= sta->sa_query_count) {
     153           0 :                 wpa_printf(MSG_DEBUG, "IEEE 802.11: No matching SA Query "
     154             :                            "transaction identifier found");
     155           0 :                 return;
     156             :         }
     157             : 
     158           0 :         hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
     159             :                        HOSTAPD_LEVEL_DEBUG,
     160             :                        "Reply to pending SA Query received");
     161           0 :         ap_sta_stop_sa_query(hapd, sta);
     162             : }
     163             : 
     164             : #endif /* CONFIG_IEEE80211W */
     165             : 
     166             : 
     167       46256 : static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx)
     168             : {
     169       46256 :         *pos = 0x00;
     170             : 
     171       46256 :         switch (idx) {
     172             :         case 0: /* Bits 0-7 */
     173        5784 :                 if (hapd->iconf->obss_interval)
     174          28 :                         *pos |= 0x01; /* Bit 0 - Coexistence management */
     175        5784 :                 break;
     176             :         case 1: /* Bits 8-15 */
     177        5784 :                 break;
     178             :         case 2: /* Bits 16-23 */
     179        5784 :                 if (hapd->conf->wnm_sleep_mode)
     180          28 :                         *pos |= 0x02; /* Bit 17 - WNM-Sleep Mode */
     181        5784 :                 if (hapd->conf->bss_transition)
     182          46 :                         *pos |= 0x08; /* Bit 19 - BSS Transition */
     183        5784 :                 break;
     184             :         case 3: /* Bits 24-31 */
     185             : #ifdef CONFIG_WNM
     186        5784 :                 *pos |= 0x02; /* Bit 25 - SSID List */
     187             : #endif /* CONFIG_WNM */
     188        5784 :                 if (hapd->conf->time_advertisement == 2)
     189          28 :                         *pos |= 0x08; /* Bit 27 - UTC TSF Offset */
     190        5784 :                 if (hapd->conf->interworking)
     191         549 :                         *pos |= 0x80; /* Bit 31 - Interworking */
     192        5784 :                 break;
     193             :         case 4: /* Bits 32-39 */
     194        5780 :                 if (hapd->conf->qos_map_set_len)
     195           4 :                         *pos |= 0x01; /* Bit 32 - QoS Map */
     196        5780 :                 if (hapd->conf->tdls & TDLS_PROHIBIT)
     197           0 :                         *pos |= 0x40; /* Bit 38 - TDLS Prohibited */
     198        5780 :                 if (hapd->conf->tdls & TDLS_PROHIBIT_CHAN_SWITCH) {
     199             :                         /* Bit 39 - TDLS Channel Switching Prohibited */
     200           0 :                         *pos |= 0x80;
     201             :                 }
     202        5780 :                 break;
     203             :         case 5: /* Bits 40-47 */
     204             : #ifdef CONFIG_HS20
     205        5780 :                 if (hapd->conf->hs20)
     206         549 :                         *pos |= 0x40; /* Bit 46 - WNM-Notification */
     207             : #endif /* CONFIG_HS20 */
     208        5780 :                 break;
     209             :         case 6: /* Bits 48-55 */
     210        5780 :                 if (hapd->conf->ssid.utf8_ssid)
     211           6 :                         *pos |= 0x01; /* Bit 48 - UTF-8 SSID */
     212        5780 :                 break;
     213             :         }
     214       46256 : }
     215             : 
     216             : 
     217        5784 : u8 * hostapd_eid_ext_capab(struct hostapd_data *hapd, u8 *eid)
     218             : {
     219        5784 :         u8 *pos = eid;
     220        5784 :         u8 len = 0, i;
     221             : 
     222        5784 :         if (hapd->conf->tdls & (TDLS_PROHIBIT | TDLS_PROHIBIT_CHAN_SWITCH))
     223           0 :                 len = 5;
     224        5784 :         if (len < 4 && hapd->conf->interworking)
     225         549 :                 len = 4;
     226        5784 :         if (len < 3 && hapd->conf->wnm_sleep_mode)
     227          28 :                 len = 3;
     228        5784 :         if (len < 1 && hapd->iconf->obss_interval)
     229          28 :                 len = 1;
     230        5784 :         if (len < 7 && hapd->conf->ssid.utf8_ssid)
     231           6 :                 len = 7;
     232             : #ifdef CONFIG_WNM
     233        5784 :         if (len < 4)
     234        5229 :                 len = 4;
     235             : #endif /* CONFIG_WNM */
     236             : #ifdef CONFIG_HS20
     237        5784 :         if (hapd->conf->hs20 && len < 6)
     238         549 :                 len = 6;
     239             : #endif /* CONFIG_HS20 */
     240        5784 :         if (len < hapd->iface->extended_capa_len)
     241        5780 :                 len = hapd->iface->extended_capa_len;
     242        5784 :         if (len == 0)
     243           0 :                 return eid;
     244             : 
     245        5784 :         *pos++ = WLAN_EID_EXT_CAPAB;
     246        5784 :         *pos++ = len;
     247       52040 :         for (i = 0; i < len; i++, pos++) {
     248       46256 :                 hostapd_ext_capab_byte(hapd, pos, i);
     249             : 
     250       46256 :                 if (i < hapd->iface->extended_capa_len) {
     251       46240 :                         *pos &= ~hapd->iface->extended_capa_mask[i];
     252       46240 :                         *pos |= hapd->iface->extended_capa[i];
     253             :                 }
     254             :         }
     255             : 
     256       11568 :         while (len > 0 && eid[1 + len] == 0) {
     257           0 :                 len--;
     258           0 :                 eid[1] = len;
     259             :         }
     260        5784 :         if (len == 0)
     261           0 :                 return eid;
     262             : 
     263        5784 :         return eid + 2 + len;
     264             : }
     265             : 
     266             : 
     267        1015 : u8 * hostapd_eid_qos_map_set(struct hostapd_data *hapd, u8 *eid)
     268             : {
     269        1015 :         u8 *pos = eid;
     270        1015 :         u8 len = hapd->conf->qos_map_set_len;
     271             : 
     272        1015 :         if (!len)
     273        1014 :                 return eid;
     274             : 
     275           1 :         *pos++ = WLAN_EID_QOS_MAP_SET;
     276           1 :         *pos++ = len;
     277           1 :         os_memcpy(pos, hapd->conf->qos_map_set, len);
     278           1 :         pos += len;
     279             : 
     280           1 :         return pos;
     281             : }
     282             : 
     283             : 
     284        4755 : u8 * hostapd_eid_interworking(struct hostapd_data *hapd, u8 *eid)
     285             : {
     286        4755 :         u8 *pos = eid;
     287             : #ifdef CONFIG_INTERWORKING
     288             :         u8 *len;
     289             : 
     290        4755 :         if (!hapd->conf->interworking)
     291        4288 :                 return eid;
     292             : 
     293         467 :         *pos++ = WLAN_EID_INTERWORKING;
     294         467 :         len = pos++;
     295             : 
     296         467 :         *pos = hapd->conf->access_network_type;
     297         467 :         if (hapd->conf->internet)
     298         467 :                 *pos |= INTERWORKING_ANO_INTERNET;
     299         467 :         if (hapd->conf->asra)
     300           0 :                 *pos |= INTERWORKING_ANO_ASRA;
     301         467 :         if (hapd->conf->esr)
     302           0 :                 *pos |= INTERWORKING_ANO_ESR;
     303         467 :         if (hapd->conf->uesa)
     304           0 :                 *pos |= INTERWORKING_ANO_UESA;
     305         467 :         pos++;
     306             : 
     307         467 :         if (hapd->conf->venue_info_set) {
     308         463 :                 *pos++ = hapd->conf->venue_group;
     309         463 :                 *pos++ = hapd->conf->venue_type;
     310             :         }
     311             : 
     312         467 :         if (!is_zero_ether_addr(hapd->conf->hessid)) {
     313         189 :                 os_memcpy(pos, hapd->conf->hessid, ETH_ALEN);
     314         189 :                 pos += ETH_ALEN;
     315             :         }
     316             : 
     317         467 :         *len = pos - len - 1;
     318             : #endif /* CONFIG_INTERWORKING */
     319             : 
     320         467 :         return pos;
     321             : }
     322             : 
     323             : 
     324        4755 : u8 * hostapd_eid_adv_proto(struct hostapd_data *hapd, u8 *eid)
     325             : {
     326        4755 :         u8 *pos = eid;
     327             : #ifdef CONFIG_INTERWORKING
     328             : 
     329             :         /* TODO: Separate configuration for ANQP? */
     330        4755 :         if (!hapd->conf->interworking)
     331        4288 :                 return eid;
     332             : 
     333         467 :         *pos++ = WLAN_EID_ADV_PROTO;
     334         467 :         *pos++ = 2;
     335         467 :         *pos++ = 0x7F; /* Query Response Length Limit | PAME-BI */
     336         467 :         *pos++ = ACCESS_NETWORK_QUERY_PROTOCOL;
     337             : #endif /* CONFIG_INTERWORKING */
     338             : 
     339         467 :         return pos;
     340             : }
     341             : 
     342             : 
     343        4755 : u8 * hostapd_eid_roaming_consortium(struct hostapd_data *hapd, u8 *eid)
     344             : {
     345        4755 :         u8 *pos = eid;
     346             : #ifdef CONFIG_INTERWORKING
     347             :         u8 *len;
     348             :         unsigned int i, count;
     349             : 
     350        5222 :         if (!hapd->conf->interworking ||
     351         934 :             hapd->conf->roaming_consortium == NULL ||
     352         467 :             hapd->conf->roaming_consortium_count == 0)
     353        4288 :                 return eid;
     354             : 
     355         467 :         *pos++ = WLAN_EID_ROAMING_CONSORTIUM;
     356         467 :         len = pos++;
     357             : 
     358             :         /* Number of ANQP OIs (in addition to the max 3 listed here) */
     359         467 :         if (hapd->conf->roaming_consortium_count > 3 + 255)
     360           0 :                 *pos++ = 255;
     361         467 :         else if (hapd->conf->roaming_consortium_count > 3)
     362         448 :                 *pos++ = hapd->conf->roaming_consortium_count - 3;
     363             :         else
     364          19 :                 *pos++ = 0;
     365             : 
     366             :         /* OU #1 and #2 Lengths */
     367         467 :         *pos = hapd->conf->roaming_consortium[0].len;
     368         467 :         if (hapd->conf->roaming_consortium_count > 1)
     369         448 :                 *pos |= hapd->conf->roaming_consortium[1].len << 4;
     370         467 :         pos++;
     371             : 
     372         467 :         if (hapd->conf->roaming_consortium_count > 3)
     373         448 :                 count = 3;
     374             :         else
     375          19 :                 count = hapd->conf->roaming_consortium_count;
     376             : 
     377        1830 :         for (i = 0; i < count; i++) {
     378        1363 :                 os_memcpy(pos, hapd->conf->roaming_consortium[i].oi,
     379             :                           hapd->conf->roaming_consortium[i].len);
     380        1363 :                 pos += hapd->conf->roaming_consortium[i].len;
     381             :         }
     382             : 
     383         467 :         *len = pos - len - 1;
     384             : #endif /* CONFIG_INTERWORKING */
     385             : 
     386         467 :         return pos;
     387             : }
     388             : 
     389             : 
     390        4755 : u8 * hostapd_eid_time_adv(struct hostapd_data *hapd, u8 *eid)
     391             : {
     392        4755 :         if (hapd->conf->time_advertisement != 2)
     393        4733 :                 return eid;
     394             : 
     395          28 :         if (hapd->time_adv == NULL &&
     396           6 :             hostapd_update_time_adv(hapd) < 0)
     397           0 :                 return eid;
     398             : 
     399          22 :         if (hapd->time_adv == NULL)
     400           0 :                 return eid;
     401             : 
     402          22 :         os_memcpy(eid, wpabuf_head(hapd->time_adv),
     403             :                   wpabuf_len(hapd->time_adv));
     404          22 :         eid += wpabuf_len(hapd->time_adv);
     405             : 
     406          22 :         return eid;
     407             : }
     408             : 
     409             : 
     410        3101 : u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid)
     411             : {
     412             :         size_t len;
     413             : 
     414        3101 :         if (hapd->conf->time_advertisement != 2)
     415        3085 :                 return eid;
     416             : 
     417          16 :         len = os_strlen(hapd->conf->time_zone);
     418             : 
     419          16 :         *eid++ = WLAN_EID_TIME_ZONE;
     420          16 :         *eid++ = len;
     421          16 :         os_memcpy(eid, hapd->conf->time_zone, len);
     422          16 :         eid += len;
     423             : 
     424          16 :         return eid;
     425             : }
     426             : 
     427             : 
     428           6 : int hostapd_update_time_adv(struct hostapd_data *hapd)
     429             : {
     430           6 :         const int elen = 2 + 1 + 10 + 5 + 1;
     431             :         struct os_time t;
     432             :         struct os_tm tm;
     433             :         u8 *pos;
     434             : 
     435           6 :         if (hapd->conf->time_advertisement != 2)
     436           0 :                 return 0;
     437             : 
     438           6 :         if (os_get_time(&t) < 0 || os_gmtime(t.sec, &tm) < 0)
     439           0 :                 return -1;
     440             : 
     441           6 :         if (!hapd->time_adv) {
     442           6 :                 hapd->time_adv = wpabuf_alloc(elen);
     443           6 :                 if (hapd->time_adv == NULL)
     444           0 :                         return -1;
     445           6 :                 pos = wpabuf_put(hapd->time_adv, elen);
     446             :         } else
     447           0 :                 pos = wpabuf_mhead_u8(hapd->time_adv);
     448             : 
     449           6 :         *pos++ = WLAN_EID_TIME_ADVERTISEMENT;
     450           6 :         *pos++ = 1 + 10 + 5 + 1;
     451             : 
     452           6 :         *pos++ = 2; /* UTC time at which the TSF timer is 0 */
     453             : 
     454             :         /* Time Value at TSF 0 */
     455             :         /* FIX: need to calculate this based on the current TSF value */
     456           6 :         WPA_PUT_LE16(pos, tm.year); /* Year */
     457           6 :         pos += 2;
     458           6 :         *pos++ = tm.month; /* Month */
     459           6 :         *pos++ = tm.day; /* Day of month */
     460           6 :         *pos++ = tm.hour; /* Hours */
     461           6 :         *pos++ = tm.min; /* Minutes */
     462           6 :         *pos++ = tm.sec; /* Seconds */
     463           6 :         WPA_PUT_LE16(pos, 0); /* Milliseconds (not used) */
     464           6 :         pos += 2;
     465           6 :         *pos++ = 0; /* Reserved */
     466             : 
     467             :         /* Time Error */
     468             :         /* TODO: fill in an estimate on the error */
     469           6 :         *pos++ = 0;
     470           6 :         *pos++ = 0;
     471           6 :         *pos++ = 0;
     472           6 :         *pos++ = 0;
     473           6 :         *pos++ = 0;
     474             : 
     475           6 :         *pos++ = hapd->time_update_counter++;
     476             : 
     477           6 :         return 0;
     478             : }
     479             : 
     480             : 
     481        1029 : u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid)
     482             : {
     483        1029 :         u8 *pos = eid;
     484             : 
     485             : #ifdef CONFIG_WNM
     486        1029 :         if (hapd->conf->ap_max_inactivity > 0) {
     487             :                 unsigned int val;
     488        1029 :                 *pos++ = WLAN_EID_BSS_MAX_IDLE_PERIOD;
     489        1029 :                 *pos++ = 3;
     490        1029 :                 val = hapd->conf->ap_max_inactivity;
     491        1029 :                 if (val > 68000)
     492           0 :                         val = 68000;
     493        1029 :                 val *= 1000;
     494        1029 :                 val /= 1024;
     495        1029 :                 if (val == 0)
     496           3 :                         val = 1;
     497        1029 :                 if (val > 65535)
     498           0 :                         val = 65535;
     499        1029 :                 WPA_PUT_LE16(pos, val);
     500        1029 :                 pos += 2;
     501        1029 :                 *pos++ = 0x00; /* TODO: Protected Keep-Alive Required */
     502             :         }
     503             : #endif /* CONFIG_WNM */
     504             : 
     505        1029 :         return pos;
     506             : }

Generated by: LCOV version 1.10