LCOV - code coverage report
Current view: top level - src/ap - ap_config.c (source / functions) Hit Total Coverage
Test: hostapd/hlr_auc_gw (AS) hwsim test run 1388338050 Lines: 243 498 48.8 %
Date: 2013-12-29 Functions: 14 24 58.3 %
Branches: 45 266 16.9 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * hostapd / Configuration helper functions
       3                 :            :  * Copyright (c) 2003-2013, 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 "crypto/sha1.h"
      13                 :            : #include "radius/radius_client.h"
      14                 :            : #include "common/ieee802_11_defs.h"
      15                 :            : #include "common/eapol_common.h"
      16                 :            : #include "eap_common/eap_wsc_common.h"
      17                 :            : #include "eap_server/eap.h"
      18                 :            : #include "wpa_auth.h"
      19                 :            : #include "sta_info.h"
      20                 :            : #include "ap_config.h"
      21                 :            : 
      22                 :            : 
      23                 :          1 : static void hostapd_config_free_vlan(struct hostapd_bss_config *bss)
      24                 :            : {
      25                 :            :         struct hostapd_vlan *vlan, *prev;
      26                 :            : 
      27                 :          1 :         vlan = bss->vlan;
      28                 :          1 :         prev = NULL;
      29         [ -  + ]:          1 :         while (vlan) {
      30                 :          0 :                 prev = vlan;
      31                 :          0 :                 vlan = vlan->next;
      32                 :          0 :                 os_free(prev);
      33                 :            :         }
      34                 :            : 
      35                 :          1 :         bss->vlan = NULL;
      36                 :          1 : }
      37                 :            : 
      38                 :            : 
      39                 :          1 : void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
      40                 :            : {
      41                 :          1 :         bss->logger_syslog_level = HOSTAPD_LEVEL_INFO;
      42                 :          1 :         bss->logger_stdout_level = HOSTAPD_LEVEL_INFO;
      43                 :          1 :         bss->logger_syslog = (unsigned int) -1;
      44                 :          1 :         bss->logger_stdout = (unsigned int) -1;
      45                 :            : 
      46                 :          1 :         bss->auth_algs = WPA_AUTH_ALG_OPEN | WPA_AUTH_ALG_SHARED;
      47                 :            : 
      48                 :          1 :         bss->wep_rekeying_period = 300;
      49                 :            :         /* use key0 in individual key and key1 in broadcast key */
      50                 :          1 :         bss->broadcast_key_idx_min = 1;
      51                 :          1 :         bss->broadcast_key_idx_max = 2;
      52                 :          1 :         bss->eap_reauth_period = 3600;
      53                 :            : 
      54                 :          1 :         bss->wpa_group_rekey = 600;
      55                 :          1 :         bss->wpa_gmk_rekey = 86400;
      56                 :          1 :         bss->wpa_key_mgmt = WPA_KEY_MGMT_PSK;
      57                 :          1 :         bss->wpa_pairwise = WPA_CIPHER_TKIP;
      58                 :          1 :         bss->wpa_group = WPA_CIPHER_TKIP;
      59                 :          1 :         bss->rsn_pairwise = 0;
      60                 :            : 
      61                 :          1 :         bss->max_num_sta = MAX_STA_COUNT;
      62                 :            : 
      63                 :          1 :         bss->dtim_period = 2;
      64                 :            : 
      65                 :          1 :         bss->radius_server_auth_port = 1812;
      66                 :          1 :         bss->ap_max_inactivity = AP_MAX_INACTIVITY;
      67                 :          1 :         bss->eapol_version = EAPOL_VERSION;
      68                 :            : 
      69                 :          1 :         bss->max_listen_interval = 65535;
      70                 :            : 
      71                 :          1 :         bss->pwd_group = 19; /* ECC: GF(p=256) */
      72                 :            : 
      73                 :            : #ifdef CONFIG_IEEE80211W
      74                 :          1 :         bss->assoc_sa_query_max_timeout = 1000;
      75                 :          1 :         bss->assoc_sa_query_retry_timeout = 201;
      76                 :            : #endif /* CONFIG_IEEE80211W */
      77                 :            : #ifdef EAP_SERVER_FAST
      78                 :            :          /* both anonymous and authenticated provisioning */
      79                 :          1 :         bss->eap_fast_prov = 3;
      80                 :          1 :         bss->pac_key_lifetime = 7 * 24 * 60 * 60;
      81                 :          1 :         bss->pac_key_refresh_time = 1 * 24 * 60 * 60;
      82                 :            : #endif /* EAP_SERVER_FAST */
      83                 :            : 
      84                 :            :         /* Set to -1 as defaults depends on HT in setup */
      85                 :          1 :         bss->wmm_enabled = -1;
      86                 :            : 
      87                 :            : #ifdef CONFIG_IEEE80211R
      88                 :          1 :         bss->ft_over_ds = 1;
      89                 :            : #endif /* CONFIG_IEEE80211R */
      90                 :            : 
      91                 :          1 :         bss->radius_das_time_window = 300;
      92                 :            : 
      93                 :          1 :         bss->sae_anti_clogging_threshold = 5;
      94                 :          1 : }
      95                 :            : 
      96                 :            : 
      97                 :          1 : struct hostapd_config * hostapd_config_defaults(void)
      98                 :            : {
      99                 :            : #define ecw2cw(ecw) ((1 << (ecw)) - 1)
     100                 :            : 
     101                 :            :         struct hostapd_config *conf;
     102                 :            :         struct hostapd_bss_config *bss;
     103                 :          1 :         const int aCWmin = 4, aCWmax = 10;
     104                 :          1 :         const struct hostapd_wmm_ac_params ac_bk =
     105                 :            :                 { aCWmin, aCWmax, 7, 0, 0 }; /* background traffic */
     106                 :          1 :         const struct hostapd_wmm_ac_params ac_be =
     107                 :            :                 { aCWmin, aCWmax, 3, 0, 0 }; /* best effort traffic */
     108                 :          1 :         const struct hostapd_wmm_ac_params ac_vi = /* video traffic */
     109                 :          1 :                 { aCWmin - 1, aCWmin, 2, 3000 / 32, 0 };
     110                 :          2 :         const struct hostapd_wmm_ac_params ac_vo = /* voice traffic */
     111                 :          2 :                 { aCWmin - 2, aCWmin - 1, 2, 1500 / 32, 0 };
     112                 :          3 :         const struct hostapd_tx_queue_params txq_bk =
     113                 :          2 :                 { 7, ecw2cw(aCWmin), ecw2cw(aCWmax), 0 };
     114                 :          3 :         const struct hostapd_tx_queue_params txq_be =
     115                 :          2 :                 { 3, ecw2cw(aCWmin), 4 * (ecw2cw(aCWmin) + 1) - 1, 0};
     116                 :          3 :         const struct hostapd_tx_queue_params txq_vi =
     117                 :          2 :                 { 1, (ecw2cw(aCWmin) + 1) / 2 - 1, ecw2cw(aCWmin), 30};
     118                 :          3 :         const struct hostapd_tx_queue_params txq_vo =
     119                 :          1 :                 { 1, (ecw2cw(aCWmin) + 1) / 4 - 1,
     120                 :          1 :                   (ecw2cw(aCWmin) + 1) / 2 - 1, 15};
     121                 :            : 
     122                 :            : #undef ecw2cw
     123                 :            : 
     124                 :          1 :         conf = os_zalloc(sizeof(*conf));
     125                 :          1 :         bss = os_zalloc(sizeof(*bss));
     126 [ +  - ][ -  + ]:          1 :         if (conf == NULL || bss == NULL) {
     127                 :          0 :                 wpa_printf(MSG_ERROR, "Failed to allocate memory for "
     128                 :            :                            "configuration data.");
     129                 :          0 :                 os_free(conf);
     130                 :          0 :                 os_free(bss);
     131                 :          0 :                 return NULL;
     132                 :            :         }
     133                 :          1 :         conf->bss = os_calloc(1, sizeof(struct hostapd_bss_config *));
     134         [ -  + ]:          1 :         if (conf->bss == NULL) {
     135                 :          0 :                 os_free(conf);
     136                 :          0 :                 os_free(bss);
     137                 :          0 :                 return NULL;
     138                 :            :         }
     139                 :          1 :         conf->bss[0] = bss;
     140                 :            : 
     141                 :          1 :         bss->radius = os_zalloc(sizeof(*bss->radius));
     142         [ -  + ]:          1 :         if (bss->radius == NULL) {
     143                 :          0 :                 os_free(conf);
     144                 :          0 :                 os_free(bss);
     145                 :          0 :                 return NULL;
     146                 :            :         }
     147                 :            : 
     148                 :          1 :         hostapd_config_defaults_bss(bss);
     149                 :            : 
     150                 :          1 :         conf->num_bss = 1;
     151                 :            : 
     152                 :          1 :         conf->beacon_int = 100;
     153                 :          1 :         conf->rts_threshold = -1; /* use driver default: 2347 */
     154                 :          1 :         conf->fragm_threshold = -1; /* user driver default: 2346 */
     155                 :          1 :         conf->send_probe_response = 1;
     156                 :            : 
     157                 :          1 :         conf->wmm_ac_params[0] = ac_be;
     158                 :          1 :         conf->wmm_ac_params[1] = ac_bk;
     159                 :          1 :         conf->wmm_ac_params[2] = ac_vi;
     160                 :          1 :         conf->wmm_ac_params[3] = ac_vo;
     161                 :            : 
     162                 :          1 :         conf->tx_queue[0] = txq_vo;
     163                 :          1 :         conf->tx_queue[1] = txq_vi;
     164                 :          1 :         conf->tx_queue[2] = txq_be;
     165                 :          1 :         conf->tx_queue[3] = txq_bk;
     166                 :            : 
     167                 :          1 :         conf->ht_capab = HT_CAP_INFO_SMPS_DISABLED;
     168                 :            : 
     169                 :          1 :         conf->ap_table_max_size = 255;
     170                 :          1 :         conf->ap_table_expiration_time = 60;
     171                 :            : 
     172                 :            : #ifdef CONFIG_TESTING_OPTIONS
     173                 :          1 :         conf->ignore_probe_probability = 0.0d;
     174                 :          1 :         conf->ignore_auth_probability = 0.0d;
     175                 :          1 :         conf->ignore_assoc_probability = 0.0d;
     176                 :          1 :         conf->ignore_reassoc_probability = 0.0d;
     177                 :          1 :         conf->corrupt_gtk_rekey_mic_probability = 0.0d;
     178                 :            : #endif /* CONFIG_TESTING_OPTIONS */
     179                 :            : 
     180                 :            : #ifdef CONFIG_ACS
     181                 :          1 :         conf->acs_num_scans = 5;
     182                 :            : #endif /* CONFIG_ACS */
     183                 :            : 
     184                 :          1 :         return conf;
     185                 :            : }
     186                 :            : 
     187                 :            : 
     188                 :          0 : int hostapd_mac_comp(const void *a, const void *b)
     189                 :            : {
     190                 :          0 :         return os_memcmp(a, b, sizeof(macaddr));
     191                 :            : }
     192                 :            : 
     193                 :            : 
     194                 :          2 : int hostapd_mac_comp_empty(const void *a)
     195                 :            : {
     196                 :          2 :         macaddr empty = { 0 };
     197                 :          2 :         return os_memcmp(a, empty, sizeof(macaddr));
     198                 :            : }
     199                 :            : 
     200                 :            : 
     201                 :          0 : static int hostapd_config_read_wpa_psk(const char *fname,
     202                 :            :                                        struct hostapd_ssid *ssid)
     203                 :            : {
     204                 :            :         FILE *f;
     205                 :            :         char buf[128], *pos;
     206                 :          0 :         int line = 0, ret = 0, len, ok;
     207                 :            :         u8 addr[ETH_ALEN];
     208                 :            :         struct hostapd_wpa_psk *psk;
     209                 :            : 
     210         [ #  # ]:          0 :         if (!fname)
     211                 :          0 :                 return 0;
     212                 :            : 
     213                 :          0 :         f = fopen(fname, "r");
     214         [ #  # ]:          0 :         if (!f) {
     215                 :          0 :                 wpa_printf(MSG_ERROR, "WPA PSK file '%s' not found.", fname);
     216                 :          0 :                 return -1;
     217                 :            :         }
     218                 :            : 
     219         [ #  # ]:          0 :         while (fgets(buf, sizeof(buf), f)) {
     220                 :          0 :                 line++;
     221                 :            : 
     222         [ #  # ]:          0 :                 if (buf[0] == '#')
     223                 :          0 :                         continue;
     224                 :          0 :                 pos = buf;
     225         [ #  # ]:          0 :                 while (*pos != '\0') {
     226         [ #  # ]:          0 :                         if (*pos == '\n') {
     227                 :          0 :                                 *pos = '\0';
     228                 :          0 :                                 break;
     229                 :            :                         }
     230                 :          0 :                         pos++;
     231                 :            :                 }
     232         [ #  # ]:          0 :                 if (buf[0] == '\0')
     233                 :          0 :                         continue;
     234                 :            : 
     235         [ #  # ]:          0 :                 if (hwaddr_aton(buf, addr)) {
     236                 :          0 :                         wpa_printf(MSG_ERROR, "Invalid MAC address '%s' on "
     237                 :            :                                    "line %d in '%s'", buf, line, fname);
     238                 :          0 :                         ret = -1;
     239                 :          0 :                         break;
     240                 :            :                 }
     241                 :            : 
     242                 :          0 :                 psk = os_zalloc(sizeof(*psk));
     243         [ #  # ]:          0 :                 if (psk == NULL) {
     244                 :          0 :                         wpa_printf(MSG_ERROR, "WPA PSK allocation failed");
     245                 :          0 :                         ret = -1;
     246                 :          0 :                         break;
     247                 :            :                 }
     248         [ #  # ]:          0 :                 if (is_zero_ether_addr(addr))
     249                 :          0 :                         psk->group = 1;
     250                 :            :                 else
     251                 :          0 :                         os_memcpy(psk->addr, addr, ETH_ALEN);
     252                 :            : 
     253                 :          0 :                 pos = buf + 17;
     254         [ #  # ]:          0 :                 if (*pos == '\0') {
     255                 :          0 :                         wpa_printf(MSG_ERROR, "No PSK on line %d in '%s'",
     256                 :            :                                    line, fname);
     257                 :          0 :                         os_free(psk);
     258                 :          0 :                         ret = -1;
     259                 :          0 :                         break;
     260                 :            :                 }
     261                 :          0 :                 pos++;
     262                 :            : 
     263                 :          0 :                 ok = 0;
     264                 :          0 :                 len = os_strlen(pos);
     265 [ #  # ][ #  # ]:          0 :                 if (len == 64 && hexstr2bin(pos, psk->psk, PMK_LEN) == 0)
     266                 :          0 :                         ok = 1;
     267 [ #  # ][ #  # ]:          0 :                 else if (len >= 8 && len < 64) {
     268                 :          0 :                         pbkdf2_sha1(pos, ssid->ssid, ssid->ssid_len,
     269                 :          0 :                                     4096, psk->psk, PMK_LEN);
     270                 :          0 :                         ok = 1;
     271                 :            :                 }
     272         [ #  # ]:          0 :                 if (!ok) {
     273                 :          0 :                         wpa_printf(MSG_ERROR, "Invalid PSK '%s' on line %d in "
     274                 :            :                                    "'%s'", pos, line, fname);
     275                 :          0 :                         os_free(psk);
     276                 :          0 :                         ret = -1;
     277                 :          0 :                         break;
     278                 :            :                 }
     279                 :            : 
     280                 :          0 :                 psk->next = ssid->wpa_psk;
     281                 :          0 :                 ssid->wpa_psk = psk;
     282                 :            :         }
     283                 :            : 
     284                 :          0 :         fclose(f);
     285                 :            : 
     286                 :          0 :         return ret;
     287                 :            : }
     288                 :            : 
     289                 :            : 
     290                 :          0 : static int hostapd_derive_psk(struct hostapd_ssid *ssid)
     291                 :            : {
     292                 :          0 :         ssid->wpa_psk = os_zalloc(sizeof(struct hostapd_wpa_psk));
     293         [ #  # ]:          0 :         if (ssid->wpa_psk == NULL) {
     294                 :          0 :                 wpa_printf(MSG_ERROR, "Unable to alloc space for PSK");
     295                 :          0 :                 return -1;
     296                 :            :         }
     297                 :          0 :         wpa_hexdump_ascii(MSG_DEBUG, "SSID",
     298                 :          0 :                           (u8 *) ssid->ssid, ssid->ssid_len);
     299                 :          0 :         wpa_hexdump_ascii_key(MSG_DEBUG, "PSK (ASCII passphrase)",
     300                 :          0 :                               (u8 *) ssid->wpa_passphrase,
     301                 :          0 :                               os_strlen(ssid->wpa_passphrase));
     302                 :          0 :         pbkdf2_sha1(ssid->wpa_passphrase,
     303                 :          0 :                     ssid->ssid, ssid->ssid_len,
     304                 :          0 :                     4096, ssid->wpa_psk->psk, PMK_LEN);
     305                 :          0 :         wpa_hexdump_key(MSG_DEBUG, "PSK (from passphrase)",
     306                 :          0 :                         ssid->wpa_psk->psk, PMK_LEN);
     307                 :          0 :         return 0;
     308                 :            : }
     309                 :            : 
     310                 :            : 
     311                 :          1 : int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf)
     312                 :            : {
     313                 :          1 :         struct hostapd_ssid *ssid = &conf->ssid;
     314                 :            : 
     315         [ -  + ]:          1 :         if (ssid->wpa_passphrase != NULL) {
     316         [ #  # ]:          0 :                 if (ssid->wpa_psk != NULL) {
     317                 :          0 :                         wpa_printf(MSG_DEBUG, "Using pre-configured WPA PSK "
     318                 :            :                                    "instead of passphrase");
     319                 :            :                 } else {
     320                 :          0 :                         wpa_printf(MSG_DEBUG, "Deriving WPA PSK based on "
     321                 :            :                                    "passphrase");
     322         [ #  # ]:          0 :                         if (hostapd_derive_psk(ssid) < 0)
     323                 :          0 :                                 return -1;
     324                 :            :                 }
     325                 :          0 :                 ssid->wpa_psk->group = 1;
     326                 :            :         }
     327                 :            : 
     328         [ -  + ]:          1 :         if (ssid->wpa_psk_file) {
     329         [ #  # ]:          0 :                 if (hostapd_config_read_wpa_psk(ssid->wpa_psk_file,
     330                 :            :                                                 &conf->ssid))
     331                 :          0 :                         return -1;
     332                 :            :         }
     333                 :            : 
     334                 :          1 :         return 0;
     335                 :            : }
     336                 :            : 
     337                 :            : 
     338                 :          0 : int hostapd_wep_key_cmp(struct hostapd_wep_keys *a, struct hostapd_wep_keys *b)
     339                 :            : {
     340                 :            :         int i;
     341                 :            : 
     342 [ #  # ][ #  # ]:          0 :         if (a->idx != b->idx || a->default_len != b->default_len)
     343                 :          0 :                 return 1;
     344         [ #  # ]:          0 :         for (i = 0; i < NUM_WEP_KEYS; i++)
     345 [ #  # ][ #  # ]:          0 :                 if (a->len[i] != b->len[i] ||
     346                 :          0 :                     os_memcmp(a->key[i], b->key[i], a->len[i]) != 0)
     347                 :          0 :                         return 1;
     348                 :          0 :         return 0;
     349                 :            : }
     350                 :            : 
     351                 :            : 
     352                 :          2 : static void hostapd_config_free_radius(struct hostapd_radius_server *servers,
     353                 :            :                                        int num_servers)
     354                 :            : {
     355                 :            :         int i;
     356                 :            : 
     357         [ -  + ]:          2 :         for (i = 0; i < num_servers; i++) {
     358                 :          0 :                 os_free(servers[i].shared_secret);
     359                 :            :         }
     360                 :          2 :         os_free(servers);
     361                 :          2 : }
     362                 :            : 
     363                 :            : 
     364                 :            : struct hostapd_radius_attr *
     365                 :          0 : hostapd_config_get_radius_attr(struct hostapd_radius_attr *attr, u8 type)
     366                 :            : {
     367         [ #  # ]:          0 :         for (; attr; attr = attr->next) {
     368         [ #  # ]:          0 :                 if (attr->type == type)
     369                 :          0 :                         return attr;
     370                 :            :         }
     371                 :          0 :         return NULL;
     372                 :            : }
     373                 :            : 
     374                 :            : 
     375                 :          2 : static void hostapd_config_free_radius_attr(struct hostapd_radius_attr *attr)
     376                 :            : {
     377                 :            :         struct hostapd_radius_attr *prev;
     378                 :            : 
     379         [ -  + ]:          2 :         while (attr) {
     380                 :          0 :                 prev = attr;
     381                 :          0 :                 attr = attr->next;
     382                 :          0 :                 wpabuf_free(prev->val);
     383                 :          0 :                 os_free(prev);
     384                 :            :         }
     385                 :          2 : }
     386                 :            : 
     387                 :            : 
     388                 :         32 : static void hostapd_config_free_eap_user(struct hostapd_eap_user *user)
     389                 :            : {
     390                 :         32 :         os_free(user->identity);
     391                 :         32 :         os_free(user->password);
     392                 :         32 :         os_free(user);
     393                 :         32 : }
     394                 :            : 
     395                 :            : 
     396                 :          1 : static void hostapd_config_free_wep(struct hostapd_wep_keys *keys)
     397                 :            : {
     398                 :            :         int i;
     399         [ +  + ]:          5 :         for (i = 0; i < NUM_WEP_KEYS; i++) {
     400                 :          4 :                 os_free(keys->key[i]);
     401                 :          4 :                 keys->key[i] = NULL;
     402                 :            :         }
     403                 :          1 : }
     404                 :            : 
     405                 :            : 
     406                 :          1 : void hostapd_config_free_bss(struct hostapd_bss_config *conf)
     407                 :            : {
     408                 :            :         struct hostapd_wpa_psk *psk, *prev;
     409                 :            :         struct hostapd_eap_user *user, *prev_user;
     410                 :            : 
     411         [ -  + ]:          1 :         if (conf == NULL)
     412                 :          1 :                 return;
     413                 :            : 
     414                 :          1 :         psk = conf->ssid.wpa_psk;
     415         [ -  + ]:          1 :         while (psk) {
     416                 :          0 :                 prev = psk;
     417                 :          0 :                 psk = psk->next;
     418                 :          0 :                 os_free(prev);
     419                 :            :         }
     420                 :            : 
     421                 :          1 :         os_free(conf->ssid.wpa_passphrase);
     422                 :          1 :         os_free(conf->ssid.wpa_psk_file);
     423                 :          1 :         hostapd_config_free_wep(&conf->ssid.wep);
     424                 :            : #ifdef CONFIG_FULL_DYNAMIC_VLAN
     425                 :          1 :         os_free(conf->ssid.vlan_tagged_interface);
     426                 :            : #endif /* CONFIG_FULL_DYNAMIC_VLAN */
     427                 :            : 
     428                 :          1 :         user = conf->eap_user;
     429         [ +  + ]:         33 :         while (user) {
     430                 :         32 :                 prev_user = user;
     431                 :         32 :                 user = user->next;
     432                 :         32 :                 hostapd_config_free_eap_user(prev_user);
     433                 :            :         }
     434                 :          1 :         os_free(conf->eap_user_sqlite);
     435                 :            : 
     436                 :          1 :         os_free(conf->dump_log_name);
     437                 :          1 :         os_free(conf->eap_req_id_text);
     438                 :          1 :         os_free(conf->accept_mac);
     439                 :          1 :         os_free(conf->deny_mac);
     440                 :          1 :         os_free(conf->nas_identifier);
     441         [ +  - ]:          1 :         if (conf->radius) {
     442                 :          1 :                 hostapd_config_free_radius(conf->radius->auth_servers,
     443                 :          1 :                                            conf->radius->num_auth_servers);
     444                 :          1 :                 hostapd_config_free_radius(conf->radius->acct_servers,
     445                 :          1 :                                            conf->radius->num_acct_servers);
     446                 :            :         }
     447                 :          1 :         hostapd_config_free_radius_attr(conf->radius_auth_req_attr);
     448                 :          1 :         hostapd_config_free_radius_attr(conf->radius_acct_req_attr);
     449                 :          1 :         os_free(conf->rsn_preauth_interfaces);
     450                 :          1 :         os_free(conf->ctrl_interface);
     451                 :          1 :         os_free(conf->ca_cert);
     452                 :          1 :         os_free(conf->server_cert);
     453                 :          1 :         os_free(conf->private_key);
     454                 :          1 :         os_free(conf->private_key_passwd);
     455                 :          1 :         os_free(conf->ocsp_stapling_response);
     456                 :          1 :         os_free(conf->dh_file);
     457                 :          1 :         os_free(conf->pac_opaque_encr_key);
     458                 :          1 :         os_free(conf->eap_fast_a_id);
     459                 :          1 :         os_free(conf->eap_fast_a_id_info);
     460                 :          1 :         os_free(conf->eap_sim_db);
     461                 :          1 :         os_free(conf->radius_server_clients);
     462                 :          1 :         os_free(conf->test_socket);
     463                 :          1 :         os_free(conf->radius);
     464                 :          1 :         os_free(conf->radius_das_shared_secret);
     465                 :          1 :         hostapd_config_free_vlan(conf);
     466                 :          1 :         os_free(conf->time_zone);
     467                 :            : 
     468                 :            : #ifdef CONFIG_IEEE80211R
     469                 :            :         {
     470                 :            :                 struct ft_remote_r0kh *r0kh, *r0kh_prev;
     471                 :            :                 struct ft_remote_r1kh *r1kh, *r1kh_prev;
     472                 :            : 
     473                 :          1 :                 r0kh = conf->r0kh_list;
     474                 :          1 :                 conf->r0kh_list = NULL;
     475         [ -  + ]:          1 :                 while (r0kh) {
     476                 :          0 :                         r0kh_prev = r0kh;
     477                 :          0 :                         r0kh = r0kh->next;
     478                 :          0 :                         os_free(r0kh_prev);
     479                 :            :                 }
     480                 :            : 
     481                 :          1 :                 r1kh = conf->r1kh_list;
     482                 :          1 :                 conf->r1kh_list = NULL;
     483         [ -  + ]:          1 :                 while (r1kh) {
     484                 :          0 :                         r1kh_prev = r1kh;
     485                 :          0 :                         r1kh = r1kh->next;
     486                 :          0 :                         os_free(r1kh_prev);
     487                 :            :                 }
     488                 :            :         }
     489                 :            : #endif /* CONFIG_IEEE80211R */
     490                 :            : 
     491                 :            : #ifdef CONFIG_WPS
     492                 :          1 :         os_free(conf->wps_pin_requests);
     493                 :          1 :         os_free(conf->device_name);
     494                 :          1 :         os_free(conf->manufacturer);
     495                 :          1 :         os_free(conf->model_name);
     496                 :          1 :         os_free(conf->model_number);
     497                 :          1 :         os_free(conf->serial_number);
     498                 :          1 :         os_free(conf->config_methods);
     499                 :          1 :         os_free(conf->ap_pin);
     500                 :          1 :         os_free(conf->extra_cred);
     501                 :          1 :         os_free(conf->ap_settings);
     502                 :          1 :         os_free(conf->upnp_iface);
     503                 :          1 :         os_free(conf->friendly_name);
     504                 :          1 :         os_free(conf->manufacturer_url);
     505                 :          1 :         os_free(conf->model_description);
     506                 :          1 :         os_free(conf->model_url);
     507                 :          1 :         os_free(conf->upc);
     508                 :          1 :         wpabuf_free(conf->wps_nfc_dh_pubkey);
     509                 :          1 :         wpabuf_free(conf->wps_nfc_dh_privkey);
     510                 :          1 :         wpabuf_free(conf->wps_nfc_dev_pw);
     511                 :            : #endif /* CONFIG_WPS */
     512                 :            : 
     513                 :          1 :         os_free(conf->roaming_consortium);
     514                 :          1 :         os_free(conf->venue_name);
     515                 :          1 :         os_free(conf->nai_realm_data);
     516                 :          1 :         os_free(conf->network_auth_type);
     517                 :          1 :         os_free(conf->anqp_3gpp_cell_net);
     518                 :          1 :         os_free(conf->domain_name);
     519                 :            : 
     520                 :            : #ifdef CONFIG_RADIUS_TEST
     521                 :            :         os_free(conf->dump_msk_file);
     522                 :            : #endif /* CONFIG_RADIUS_TEST */
     523                 :            : 
     524                 :            : #ifdef CONFIG_HS20
     525                 :          1 :         os_free(conf->hs20_oper_friendly_name);
     526                 :          1 :         os_free(conf->hs20_wan_metrics);
     527                 :          1 :         os_free(conf->hs20_connection_capability);
     528                 :          1 :         os_free(conf->hs20_operating_class);
     529                 :            : #endif /* CONFIG_HS20 */
     530                 :            : 
     531                 :          1 :         wpabuf_free(conf->vendor_elements);
     532                 :            : 
     533                 :          1 :         os_free(conf->sae_groups);
     534                 :            : 
     535                 :          1 :         os_free(conf->server_id);
     536                 :            : 
     537                 :          1 :         os_free(conf);
     538                 :            : }
     539                 :            : 
     540                 :            : 
     541                 :            : /**
     542                 :            :  * hostapd_config_free - Free hostapd configuration
     543                 :            :  * @conf: Configuration data from hostapd_config_read().
     544                 :            :  */
     545                 :          1 : void hostapd_config_free(struct hostapd_config *conf)
     546                 :            : {
     547                 :            :         size_t i;
     548                 :            : 
     549         [ -  + ]:          1 :         if (conf == NULL)
     550                 :          1 :                 return;
     551                 :            : 
     552         [ +  + ]:          2 :         for (i = 0; i < conf->num_bss; i++)
     553                 :          1 :                 hostapd_config_free_bss(conf->bss[i]);
     554                 :          1 :         os_free(conf->bss);
     555                 :          1 :         os_free(conf->supported_rates);
     556                 :          1 :         os_free(conf->basic_rates);
     557                 :            : 
     558                 :          1 :         os_free(conf);
     559                 :            : }
     560                 :            : 
     561                 :            : 
     562                 :            : /**
     563                 :            :  * hostapd_maclist_found - Find a MAC address from a list
     564                 :            :  * @list: MAC address list
     565                 :            :  * @num_entries: Number of addresses in the list
     566                 :            :  * @addr: Address to search for
     567                 :            :  * @vlan_id: Buffer for returning VLAN ID or %NULL if not needed
     568                 :            :  * Returns: 1 if address is in the list or 0 if not.
     569                 :            :  *
     570                 :            :  * Perform a binary search for given MAC address from a pre-sorted list.
     571                 :            :  */
     572                 :          0 : int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
     573                 :            :                           const u8 *addr, int *vlan_id)
     574                 :            : {
     575                 :            :         int start, end, middle, res;
     576                 :            : 
     577                 :          0 :         start = 0;
     578                 :          0 :         end = num_entries - 1;
     579                 :            : 
     580         [ #  # ]:          0 :         while (start <= end) {
     581                 :          0 :                 middle = (start + end) / 2;
     582                 :          0 :                 res = os_memcmp(list[middle].addr, addr, ETH_ALEN);
     583         [ #  # ]:          0 :                 if (res == 0) {
     584         [ #  # ]:          0 :                         if (vlan_id)
     585                 :          0 :                                 *vlan_id = list[middle].vlan_id;
     586                 :          0 :                         return 1;
     587                 :            :                 }
     588         [ #  # ]:          0 :                 if (res < 0)
     589                 :          0 :                         start = middle + 1;
     590                 :            :                 else
     591                 :          0 :                         end = middle - 1;
     592                 :            :         }
     593                 :            : 
     594                 :          0 :         return 0;
     595                 :            : }
     596                 :            : 
     597                 :            : 
     598                 :          0 : int hostapd_rate_found(int *list, int rate)
     599                 :            : {
     600                 :            :         int i;
     601                 :            : 
     602         [ #  # ]:          0 :         if (list == NULL)
     603                 :          0 :                 return 0;
     604                 :            : 
     605         [ #  # ]:          0 :         for (i = 0; list[i] >= 0; i++)
     606         [ #  # ]:          0 :                 if (list[i] == rate)
     607                 :          0 :                         return 1;
     608                 :            : 
     609                 :          0 :         return 0;
     610                 :            : }
     611                 :            : 
     612                 :            : 
     613                 :          0 : int hostapd_vlan_id_valid(struct hostapd_vlan *vlan, int vlan_id)
     614                 :            : {
     615                 :          0 :         struct hostapd_vlan *v = vlan;
     616         [ #  # ]:          0 :         while (v) {
     617 [ #  # ][ #  # ]:          0 :                 if (v->vlan_id == vlan_id || v->vlan_id == VLAN_ID_WILDCARD)
     618                 :          0 :                         return 1;
     619                 :          0 :                 v = v->next;
     620                 :            :         }
     621                 :          0 :         return 0;
     622                 :            : }
     623                 :            : 
     624                 :            : 
     625                 :          0 : const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan, int vlan_id)
     626                 :            : {
     627                 :          0 :         struct hostapd_vlan *v = vlan;
     628         [ #  # ]:          0 :         while (v) {
     629         [ #  # ]:          0 :                 if (v->vlan_id == vlan_id)
     630                 :          0 :                         return v->ifname;
     631                 :          0 :                 v = v->next;
     632                 :            :         }
     633                 :          0 :         return NULL;
     634                 :            : }
     635                 :            : 
     636                 :            : 
     637                 :          0 : const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
     638                 :            :                            const u8 *addr, const u8 *p2p_dev_addr,
     639                 :            :                            const u8 *prev_psk)
     640                 :            : {
     641                 :            :         struct hostapd_wpa_psk *psk;
     642                 :          0 :         int next_ok = prev_psk == NULL;
     643                 :            : 
     644         [ #  # ]:          0 :         if (p2p_dev_addr) {
     645                 :          0 :                 wpa_printf(MSG_DEBUG, "Searching a PSK for " MACSTR
     646                 :            :                            " p2p_dev_addr=" MACSTR " prev_psk=%p",
     647                 :          0 :                            MAC2STR(addr), MAC2STR(p2p_dev_addr), prev_psk);
     648         [ #  # ]:          0 :                 if (!is_zero_ether_addr(p2p_dev_addr))
     649                 :          0 :                         addr = NULL; /* Use P2P Device Address for matching */
     650                 :            :         } else {
     651                 :          0 :                 wpa_printf(MSG_DEBUG, "Searching a PSK for " MACSTR
     652                 :            :                            " prev_psk=%p",
     653                 :          0 :                            MAC2STR(addr), prev_psk);
     654                 :            :         }
     655                 :            : 
     656         [ #  # ]:          0 :         for (psk = conf->ssid.wpa_psk; psk != NULL; psk = psk->next) {
     657 [ #  # ][ #  # ]:          0 :                 if (next_ok &&
     658         [ #  # ]:          0 :                     (psk->group ||
     659 [ #  # ][ #  # ]:          0 :                      (addr && os_memcmp(psk->addr, addr, ETH_ALEN) == 0) ||
     660 [ #  # ][ #  # ]:          0 :                      (!addr && p2p_dev_addr &&
     661                 :          0 :                       os_memcmp(psk->p2p_dev_addr, p2p_dev_addr, ETH_ALEN) ==
     662                 :            :                       0)))
     663                 :          0 :                         return psk->psk;
     664                 :            : 
     665         [ #  # ]:          0 :                 if (psk->psk == prev_psk)
     666                 :          0 :                         next_ok = 1;
     667                 :            :         }
     668                 :            : 
     669                 :          0 :         return NULL;
     670                 :            : }
     671                 :            : 
     672                 :            : 
     673                 :          1 : static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
     674                 :            :                                     struct hostapd_config *conf)
     675                 :            : {
     676 [ -  + ][ #  # ]:          1 :         if (bss->ieee802_1x && !bss->eap_server &&
                 [ #  # ]
     677                 :          0 :             !bss->radius->auth_servers) {
     678                 :          0 :                 wpa_printf(MSG_ERROR, "Invalid IEEE 802.1X configuration (no "
     679                 :            :                            "EAP authenticator configured).");
     680                 :          0 :                 return -1;
     681                 :            :         }
     682                 :            : 
     683         [ -  + ]:          1 :         if (bss->wpa) {
     684                 :            :                 int wep, i;
     685                 :            : 
     686 [ #  # ][ #  # ]:          0 :                 wep = bss->default_wep_key_len > 0 ||
     687                 :          0 :                        bss->individual_wep_key_len > 0;
     688         [ #  # ]:          0 :                 for (i = 0; i < NUM_WEP_KEYS; i++) {
     689         [ #  # ]:          0 :                         if (bss->ssid.wep.keys_set) {
     690                 :          0 :                                 wep = 1;
     691                 :          0 :                                 break;
     692                 :            :                         }
     693                 :            :                 }
     694                 :            : 
     695         [ #  # ]:          0 :                 if (wep) {
     696                 :          0 :                         wpa_printf(MSG_ERROR, "WEP configuration in a WPA network is not supported");
     697                 :          0 :                         return -1;
     698                 :            :                 }
     699                 :            :         }
     700                 :            : 
     701 [ -  + ][ #  # ]:          1 :         if (bss->wpa && bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
                 [ #  # ]
     702                 :          0 :             bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) {
     703                 :          0 :                 wpa_printf(MSG_ERROR, "WPA-PSK using RADIUS enabled, but no "
     704                 :            :                            "RADIUS checking (macaddr_acl=2) enabled.");
     705                 :          0 :                 return -1;
     706                 :            :         }
     707                 :            : 
     708 [ -  + ][ #  # ]:          1 :         if (bss->wpa && (bss->wpa_key_mgmt & WPA_KEY_MGMT_PSK) &&
                 [ #  # ]
     709 [ #  # ][ #  # ]:          0 :             bss->ssid.wpa_psk == NULL && bss->ssid.wpa_passphrase == NULL &&
     710         [ #  # ]:          0 :             bss->ssid.wpa_psk_file == NULL &&
     711         [ #  # ]:          0 :             (bss->wpa_psk_radius != PSK_RADIUS_REQUIRED ||
     712                 :          0 :              bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH)) {
     713                 :          0 :                 wpa_printf(MSG_ERROR, "WPA-PSK enabled, but PSK or passphrase "
     714                 :            :                            "is not configured.");
     715                 :          0 :                 return -1;
     716                 :            :         }
     717                 :            : 
     718         [ -  + ]:          1 :         if (hostapd_mac_comp_empty(bss->bssid) != 0) {
     719                 :            :                 size_t i;
     720                 :            : 
     721         [ #  # ]:          0 :                 for (i = 0; i < conf->num_bss; i++) {
     722   [ #  #  #  # ]:          0 :                         if (conf->bss[i] != bss &&
     723                 :          0 :                             (hostapd_mac_comp(conf->bss[i]->bssid,
     724                 :          0 :                                               bss->bssid) == 0)) {
     725                 :          0 :                                 wpa_printf(MSG_ERROR, "Duplicate BSSID " MACSTR
     726                 :            :                                            " on interface '%s' and '%s'.",
     727                 :          0 :                                            MAC2STR(bss->bssid),
     728                 :          0 :                                            conf->bss[i]->iface, bss->iface);
     729                 :          0 :                                 return -1;
     730                 :            :                         }
     731                 :            :                 }
     732                 :            :         }
     733                 :            : 
     734                 :            : #ifdef CONFIG_IEEE80211R
     735 [ -  + ][ #  # ]:          1 :         if (wpa_key_mgmt_ft(bss->wpa_key_mgmt) &&
     736         [ #  # ]:          0 :             (bss->nas_identifier == NULL ||
     737         [ #  # ]:          0 :              os_strlen(bss->nas_identifier) < 1 ||
     738                 :          0 :              os_strlen(bss->nas_identifier) > FT_R0KH_ID_MAX_LEN)) {
     739                 :          0 :                 wpa_printf(MSG_ERROR, "FT (IEEE 802.11r) requires "
     740                 :            :                            "nas_identifier to be configured as a 1..48 octet "
     741                 :            :                            "string");
     742                 :          0 :                 return -1;
     743                 :            :         }
     744                 :            : #endif /* CONFIG_IEEE80211R */
     745                 :            : 
     746                 :            : #ifdef CONFIG_IEEE80211N
     747 [ -  + ][ #  # ]:          1 :         if (conf->ieee80211n && conf->hw_mode == HOSTAPD_MODE_IEEE80211B) {
     748                 :          0 :                 bss->disable_11n = 1;
     749                 :          0 :                 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) in 11b mode is not "
     750                 :            :                            "allowed, disabling HT capabilites");
     751                 :            :         }
     752                 :            : 
     753 [ -  + ][ #  # ]:          1 :         if (conf->ieee80211n &&
     754                 :          0 :             bss->ssid.security_policy == SECURITY_STATIC_WEP) {
     755                 :          0 :                 bss->disable_11n = 1;
     756                 :          0 :                 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) with WEP is not "
     757                 :            :                            "allowed, disabling HT capabilities");
     758                 :            :         }
     759                 :            : 
     760 [ -  + ][ #  # ]:          1 :         if (conf->ieee80211n && bss->wpa &&
                 [ #  # ]
     761         [ #  # ]:          0 :             !(bss->wpa_pairwise & WPA_CIPHER_CCMP) &&
     762                 :          0 :             !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP |
     763                 :            :                                    WPA_CIPHER_CCMP_256 | WPA_CIPHER_GCMP_256)))
     764                 :            :         {
     765                 :          0 :                 bss->disable_11n = 1;
     766                 :          0 :                 wpa_printf(MSG_ERROR, "HT (IEEE 802.11n) with WPA/WPA2 "
     767                 :            :                            "requires CCMP/GCMP to be enabled, disabling HT "
     768                 :            :                            "capabilities");
     769                 :            :         }
     770                 :            : #endif /* CONFIG_IEEE80211N */
     771                 :            : 
     772                 :            : #ifdef CONFIG_WPS2
     773 [ -  + ][ #  # ]:          1 :         if (bss->wps_state && bss->ignore_broadcast_ssid) {
     774                 :          0 :                 wpa_printf(MSG_INFO, "WPS: ignore_broadcast_ssid "
     775                 :            :                            "configuration forced WPS to be disabled");
     776                 :          0 :                 bss->wps_state = 0;
     777                 :            :         }
     778                 :            : 
     779 [ -  + ][ #  # ]:          1 :         if (bss->wps_state && bss->ssid.wep.keys_set && bss->wpa == 0) {
                 [ #  # ]
     780                 :          0 :                 wpa_printf(MSG_INFO, "WPS: WEP configuration forced WPS to be "
     781                 :            :                            "disabled");
     782                 :          0 :                 bss->wps_state = 0;
     783                 :            :         }
     784                 :            : 
     785 [ -  + ][ #  # ]:          1 :         if (bss->wps_state && bss->wpa &&
                 [ #  # ]
     786         [ #  # ]:          0 :             (!(bss->wpa & 2) ||
     787                 :          0 :              !(bss->rsn_pairwise & WPA_CIPHER_CCMP))) {
     788                 :          0 :                 wpa_printf(MSG_INFO, "WPS: WPA/TKIP configuration without "
     789                 :            :                            "WPA2/CCMP forced WPS to be disabled");
     790                 :          0 :                 bss->wps_state = 0;
     791                 :            :         }
     792                 :            : #endif /* CONFIG_WPS2 */
     793                 :            : 
     794                 :            : #ifdef CONFIG_HS20
     795 [ -  + ][ #  # ]:          1 :         if (bss->hs20 &&
     796         [ #  # ]:          0 :             (!(bss->wpa & 2) ||
     797                 :          0 :              !(bss->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP |
     798                 :            :                                     WPA_CIPHER_CCMP_256 |
     799                 :            :                                     WPA_CIPHER_GCMP_256)))) {
     800                 :          0 :                 wpa_printf(MSG_ERROR, "HS 2.0: WPA2-Enterprise/CCMP "
     801                 :            :                            "configuration is required for Hotspot 2.0 "
     802                 :            :                            "functionality");
     803                 :          0 :                 return -1;
     804                 :            :         }
     805                 :            : #endif /* CONFIG_HS20 */
     806                 :            : 
     807                 :          1 :         return 0;
     808                 :            : }
     809                 :            : 
     810                 :            : 
     811                 :          1 : int hostapd_config_check(struct hostapd_config *conf)
     812                 :            : {
     813                 :            :         size_t i;
     814                 :            : 
     815 [ -  + ][ #  # ]:          1 :         if (conf->ieee80211d && (!conf->country[0] || !conf->country[1])) {
                 [ #  # ]
     816                 :          0 :                 wpa_printf(MSG_ERROR, "Cannot enable IEEE 802.11d without "
     817                 :            :                            "setting the country_code");
     818                 :          0 :                 return -1;
     819                 :            :         }
     820                 :            : 
     821 [ -  + ][ #  # ]:          1 :         if (conf->ieee80211h && !conf->ieee80211d) {
     822                 :          0 :                 wpa_printf(MSG_ERROR, "Cannot enable IEEE 802.11h without "
     823                 :            :                            "IEEE 802.11d enabled");
     824                 :          0 :                 return -1;
     825                 :            :         }
     826                 :            : 
     827         [ +  + ]:          2 :         for (i = 0; i < conf->num_bss; i++) {
     828         [ -  + ]:          1 :                 if (hostapd_config_check_bss(conf->bss[i], conf))
     829                 :          0 :                         return -1;
     830                 :            :         }
     831                 :            : 
     832                 :          1 :         return 0;
     833                 :            : }
     834                 :            : 
     835                 :            : 
     836                 :          1 : void hostapd_set_security_params(struct hostapd_bss_config *bss)
     837                 :            : {
     838         [ +  - ]:          1 :         if (bss->individual_wep_key_len == 0) {
     839                 :            :                 /* individual keys are not use; can use key idx0 for
     840                 :            :                  * broadcast keys */
     841                 :          1 :                 bss->broadcast_key_idx_min = 0;
     842                 :            :         }
     843                 :            : 
     844 [ -  + ][ #  # ]:          1 :         if ((bss->wpa & 2) && bss->rsn_pairwise == 0)
     845                 :          0 :                 bss->rsn_pairwise = bss->wpa_pairwise;
     846                 :          1 :         bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa, bss->wpa_pairwise,
     847                 :            :                                                     bss->rsn_pairwise);
     848                 :            : 
     849                 :          1 :         bss->radius->auth_server = bss->radius->auth_servers;
     850                 :          1 :         bss->radius->acct_server = bss->radius->acct_servers;
     851                 :            : 
     852 [ -  + ][ #  # ]:          1 :         if (bss->wpa && bss->ieee802_1x) {
     853                 :          0 :                 bss->ssid.security_policy = SECURITY_WPA;
     854         [ -  + ]:          1 :         } else if (bss->wpa) {
     855                 :          0 :                 bss->ssid.security_policy = SECURITY_WPA_PSK;
     856         [ -  + ]:          1 :         } else if (bss->ieee802_1x) {
     857                 :          0 :                 int cipher = WPA_CIPHER_NONE;
     858                 :          0 :                 bss->ssid.security_policy = SECURITY_IEEE_802_1X;
     859                 :          0 :                 bss->ssid.wep.default_len = bss->default_wep_key_len;
     860         [ #  # ]:          0 :                 if (bss->default_wep_key_len)
     861                 :          0 :                         cipher = bss->default_wep_key_len >= 13 ?
     862         [ #  # ]:          0 :                                 WPA_CIPHER_WEP104 : WPA_CIPHER_WEP40;
     863                 :          0 :                 bss->wpa_group = cipher;
     864                 :          0 :                 bss->wpa_pairwise = cipher;
     865                 :          0 :                 bss->rsn_pairwise = cipher;
     866         [ -  + ]:          1 :         } else if (bss->ssid.wep.keys_set) {
     867                 :          0 :                 int cipher = WPA_CIPHER_WEP40;
     868         [ #  # ]:          0 :                 if (bss->ssid.wep.len[0] >= 13)
     869                 :          0 :                         cipher = WPA_CIPHER_WEP104;
     870                 :          0 :                 bss->ssid.security_policy = SECURITY_STATIC_WEP;
     871                 :          0 :                 bss->wpa_group = cipher;
     872                 :          0 :                 bss->wpa_pairwise = cipher;
     873                 :          0 :                 bss->rsn_pairwise = cipher;
     874                 :            :         } else {
     875                 :          1 :                 bss->ssid.security_policy = SECURITY_PLAINTEXT;
     876                 :          1 :                 bss->wpa_group = WPA_CIPHER_NONE;
     877                 :          1 :                 bss->wpa_pairwise = WPA_CIPHER_NONE;
     878                 :          1 :                 bss->rsn_pairwise = WPA_CIPHER_NONE;
     879                 :            :         }
     880                 :          1 : }

Generated by: LCOV version 1.9