Advertisement
asfermargus

mlme.c debug printk

May 5th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.32 KB | None | 0 0
  1.  
  2. static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
  3.                      struct cfg80211_bss *cbss, bool assoc,
  4.                      bool override)
  5. {
  6.     struct ieee80211_local *local = sdata->local;
  7.     struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
  8.     struct ieee80211_bss *bss = (void *)cbss->priv;
  9.     struct sta_info *new_sta = NULL;
  10.     struct ieee80211_supported_band *sband;
  11.     bool have_sta = false;
  12.     int err;
  13.  
  14.     printk(KERN_ERR "GP ieee80211_prep_connection 1\n");
  15.  
  16.     sband = local->hw.wiphy->bands[cbss->channel->band];
  17.  
  18.     if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data))
  19.         return -EINVAL;
  20.  
  21.     printk(KERN_ERR "GP ieee80211_prep_connection 2\n");
  22.  
  23.     /* If a reconfig is happening, bail out */
  24.     if (local->in_reconfig) {
  25.         printk(KERN_ERR "GP bail out\n");
  26.         return -EBUSY;
  27.     }
  28.  
  29.     printk(KERN_ERR "GP ieee80211_prep_connection 3\n");
  30.  
  31.     if (assoc) {
  32.         rcu_read_lock();
  33.         have_sta = sta_info_get(sdata, cbss->bssid);
  34.         rcu_read_unlock();
  35.     }
  36.  
  37.     printk(KERN_ERR "GP ieee80211_prep_connection 4\n");
  38.  
  39.     if (!have_sta) {
  40.         new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL);
  41.         if (!new_sta)
  42.             return -ENOMEM;
  43.     }
  44.  
  45.     printk(KERN_ERR "GP ieee80211_prep_connection 5\n");
  46.  
  47.     if (new_sta || override) {
  48.         err = ieee80211_prep_channel(sdata, cbss);
  49.         if (err) {
  50.             if (new_sta)
  51.       {
  52.                 sta_info_free(local, new_sta);
  53.       }
  54.             return -EINVAL;
  55.         }
  56.     }
  57.  
  58.     printk(KERN_ERR "GP ieee80211_prep_connection 6\n");
  59.  
  60.     if (new_sta) {
  61.         u32 rates = 0, basic_rates = 0;
  62.         bool have_higher_than_11mbit;
  63.         int min_rate = INT_MAX, min_rate_index = -1;
  64.         struct ieee80211_chanctx_conf *chanctx_conf;
  65.         const struct cfg80211_bss_ies *ies;
  66.         int shift = ieee80211_vif_get_shift(&sdata->vif);
  67.         u32 rate_flags;
  68.  
  69.  
  70.         printk(KERN_ERR "GP ieee80211_prep_connection 7\n");
  71.         rcu_read_lock();
  72.         chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  73.         if (WARN_ON(!chanctx_conf)) {
  74.             rcu_read_unlock();
  75.             sta_info_free(local, new_sta);
  76.             return -EINVAL;
  77.         }
  78.    
  79.  
  80.         printk(KERN_ERR "GP ieee80211_prep_connection 8\n");
  81.         rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def);
  82.         rcu_read_unlock();
  83.  
  84.         ieee80211_get_rates(sband, bss->supp_rates,
  85.                     bss->supp_rates_len,
  86.                     &rates, &basic_rates,
  87.                     &have_higher_than_11mbit,
  88.                     &min_rate, &min_rate_index,
  89.                     shift, rate_flags);
  90.  
  91.         /*
  92.          * This used to be a workaround for basic rates missing
  93.          * in the association response frame. Now that we no
  94.          * longer use the basic rates from there, it probably
  95.          * doesn't happen any more, but keep the workaround so
  96.          * in case some *other* APs are buggy in different ways
  97.          * we can connect -- with a warning.
  98.          */
  99.         if (!basic_rates && min_rate_index >= 0) {
  100.             sdata_info(sdata,
  101.                    "No basic rates, using min rate instead\n");
  102.             basic_rates = BIT(min_rate_index);
  103.         }
  104.    
  105.    
  106.  
  107.         printk(KERN_ERR "GP ieee80211_prep_connection 9\n");
  108.  
  109.         new_sta->sta.supp_rates[cbss->channel->band] = rates;
  110.         sdata->vif.bss_conf.basic_rates = basic_rates;
  111.  
  112.         /* cf. IEEE 802.11 9.2.12 */
  113.         if (cbss->channel->band == NL80211_BAND_2GHZ &&
  114.             have_higher_than_11mbit)
  115.             sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
  116.         else
  117.             sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
  118.  
  119.  
  120.  
  121.         printk(KERN_ERR "GP ieee80211_prep_connection 10\n");
  122.  
  123.         memcpy(ifmgd->bssid, cbss->bssid, ETH_ALEN);
  124.  
  125.         /* set timing information */
  126.         sdata->vif.bss_conf.beacon_int = cbss->beacon_interval;
  127.         rcu_read_lock();
  128.         ies = rcu_dereference(cbss->beacon_ies);
  129.         if (ies) {
  130.             const u8 *tim_ie;
  131.  
  132.             sdata->vif.bss_conf.sync_tsf = ies->tsf;
  133.             sdata->vif.bss_conf.sync_device_ts =
  134.                 bss->device_ts_beacon;
  135.             tim_ie = cfg80211_find_ie(WLAN_EID_TIM,
  136.                           ies->data, ies->len);
  137.             if (tim_ie && tim_ie[1] >= 2)
  138.                 sdata->vif.bss_conf.sync_dtim_count = tim_ie[2];
  139.             else
  140.                 sdata->vif.bss_conf.sync_dtim_count = 0;
  141.        
  142.        
  143.  
  144.         printk(KERN_ERR "GP ieee80211_prep_connection 11\n");
  145.        
  146.         } else if (!ieee80211_hw_check(&sdata->local->hw,
  147.                            TIMING_BEACON_ONLY)) {
  148.             ies = rcu_dereference(cbss->proberesp_ies);
  149.             /* must be non-NULL since beacon IEs were NULL */
  150.             sdata->vif.bss_conf.sync_tsf = ies->tsf;
  151.             sdata->vif.bss_conf.sync_device_ts =
  152.                 bss->device_ts_presp;
  153.             sdata->vif.bss_conf.sync_dtim_count = 0;
  154.         } else {
  155.             sdata->vif.bss_conf.sync_tsf = 0;
  156.             sdata->vif.bss_conf.sync_device_ts = 0;
  157.             sdata->vif.bss_conf.sync_dtim_count = 0;
  158.         }
  159.         rcu_read_unlock();
  160.  
  161.  
  162.  
  163.         printk(KERN_ERR "GP ieee80211_prep_connection 12\n");
  164.  
  165.         /* tell driver about BSSID, basic rates and timing */
  166.         ieee80211_bss_info_change_notify(sdata,
  167.             BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES |
  168.             BSS_CHANGED_BEACON_INT);
  169.  
  170.         if (assoc)
  171.             sta_info_pre_move_state(new_sta, IEEE80211_STA_AUTH);
  172.  
  173.  
  174.         printk(KERN_ERR "GP ieee80211_prep_connection 13\n");
  175.         err = sta_info_insert(new_sta);
  176.         new_sta = NULL;
  177.         if (err) {
  178.             sdata_info(sdata,
  179.                    "failed to insert STA entry for the AP (error %d)\n",
  180.                    err);
  181.             return err;
  182.         }
  183.    
  184.    
  185.  
  186.         printk(KERN_ERR "GP ieee80211_prep_connection 14\n");
  187.     } else
  188.         WARN_ON_ONCE(!ether_addr_equal(ifmgd->bssid, cbss->bssid));
  189.  
  190.  
  191.     printk(KERN_ERR "GP ieee80211_prep_connection 15\n");
  192.  
  193.  
  194.     /* Cancel scan to ensure that nothing interferes with connection */
  195.     if (local->scanning)
  196.         ieee80211_scan_cancel(local);
  197.  
  198.     return 0;
  199. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement