cfg.c (d0709a65181beb787ef3f58cfe45536a2bb254c8) | cfg.c (73651ee6396c499ccb59ebc84c9274db01ed026d) |
---|---|
1/* 2 * mac80211 configuration hooks for cfg80211 3 * 4 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 5 * 6 * This file is GPLv2 as found in COPYING. 7 */ 8 --- 557 unchanged lines hidden (view full) --- 566 struct sta_info *sta, 567 struct station_parameters *params) 568{ 569 u32 rates; 570 int i, j; 571 struct ieee80211_supported_band *sband; 572 struct ieee80211_sub_if_data *sdata = sta->sdata; 573 | 1/* 2 * mac80211 configuration hooks for cfg80211 3 * 4 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 5 * 6 * This file is GPLv2 as found in COPYING. 7 */ 8 --- 557 unchanged lines hidden (view full) --- 566 struct sta_info *sta, 567 struct station_parameters *params) 568{ 569 u32 rates; 570 int i, j; 571 struct ieee80211_supported_band *sband; 572 struct ieee80211_sub_if_data *sdata = sta->sdata; 573 |
574 /* 575 * FIXME: updating the flags is racy when this function is 576 * called from ieee80211_change_station(), this will 577 * be resolved in a future patch. 578 */ 579 |
|
574 if (params->station_flags & STATION_FLAG_CHANGED) { 575 sta->flags &= ~WLAN_STA_AUTHORIZED; 576 if (params->station_flags & STATION_FLAG_AUTHORIZED) 577 sta->flags |= WLAN_STA_AUTHORIZED; 578 579 sta->flags &= ~WLAN_STA_SHORT_PREAMBLE; 580 if (params->station_flags & STATION_FLAG_SHORT_PREAMBLE) 581 sta->flags |= WLAN_STA_SHORT_PREAMBLE; 582 583 sta->flags &= ~WLAN_STA_WME; 584 if (params->station_flags & STATION_FLAG_WME) 585 sta->flags |= WLAN_STA_WME; 586 } 587 | 580 if (params->station_flags & STATION_FLAG_CHANGED) { 581 sta->flags &= ~WLAN_STA_AUTHORIZED; 582 if (params->station_flags & STATION_FLAG_AUTHORIZED) 583 sta->flags |= WLAN_STA_AUTHORIZED; 584 585 sta->flags &= ~WLAN_STA_SHORT_PREAMBLE; 586 if (params->station_flags & STATION_FLAG_SHORT_PREAMBLE) 587 sta->flags |= WLAN_STA_SHORT_PREAMBLE; 588 589 sta->flags &= ~WLAN_STA_WME; 590 if (params->station_flags & STATION_FLAG_WME) 591 sta->flags |= WLAN_STA_WME; 592 } 593 |
594 /* 595 * FIXME: updating the following information is racy when this 596 * function is called from ieee80211_change_station(). 597 * However, all this information should be static so 598 * maybe we should just reject attemps to change it. 599 */ 600 |
|
588 if (params->aid) { 589 sta->aid = params->aid; 590 if (sta->aid > IEEE80211_MAX_AID) 591 sta->aid = 0; /* XXX: should this be an error? */ 592 } 593 594 if (params->listen_interval >= 0) 595 sta->listen_interval = params->listen_interval; --- 25 unchanged lines hidden (view full) --- 621} 622 623static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, 624 u8 *mac, struct station_parameters *params) 625{ 626 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 627 struct sta_info *sta; 628 struct ieee80211_sub_if_data *sdata; | 601 if (params->aid) { 602 sta->aid = params->aid; 603 if (sta->aid > IEEE80211_MAX_AID) 604 sta->aid = 0; /* XXX: should this be an error? */ 605 } 606 607 if (params->listen_interval >= 0) 608 sta->listen_interval = params->listen_interval; --- 25 unchanged lines hidden (view full) --- 634} 635 636static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, 637 u8 *mac, struct station_parameters *params) 638{ 639 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 640 struct sta_info *sta; 641 struct ieee80211_sub_if_data *sdata; |
642 int err; |
|
629 630 /* Prevent a race with changing the rate control algorithm */ 631 if (!netif_running(dev)) 632 return -ENETDOWN; 633 634 if (params->vlan) { 635 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 636 637 if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN || 638 sdata->vif.type != IEEE80211_IF_TYPE_AP) 639 return -EINVAL; 640 } else 641 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 642 643 if (ieee80211_vif_is_mesh(&sdata->vif)) | 643 644 /* Prevent a race with changing the rate control algorithm */ 645 if (!netif_running(dev)) 646 return -ENETDOWN; 647 648 if (params->vlan) { 649 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 650 651 if (sdata->vif.type != IEEE80211_IF_TYPE_VLAN || 652 sdata->vif.type != IEEE80211_IF_TYPE_AP) 653 return -EINVAL; 654 } else 655 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 656 657 if (ieee80211_vif_is_mesh(&sdata->vif)) |
644 sta = mesh_plink_add(mac, DEFAULT_RATES, sdata); | 658 sta = mesh_plink_alloc(sdata, mac, DEFAULT_RATES, GFP_KERNEL); |
645 else | 659 else |
646 sta = sta_info_add(sdata, mac); | 660 sta = sta_info_alloc(sdata, mac, GFP_KERNEL); 661 if (!sta) 662 return -ENOMEM; |
647 | 663 |
648 if (IS_ERR(sta)) 649 return PTR_ERR(sta); 650 651 if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN || 652 sdata->vif.type == IEEE80211_IF_TYPE_AP) 653 ieee80211_send_layer2_update(sta); 654 | |
655 sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; 656 657 sta_apply_parameters(local, sta, params); 658 659 rate_control_rate_init(sta, local); 660 | 664 sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; 665 666 sta_apply_parameters(local, sta, params); 667 668 rate_control_rate_init(sta, local); 669 |
670 rcu_read_lock(); 671 672 err = sta_info_insert(sta); 673 if (err) { 674 sta_info_destroy(sta); 675 rcu_read_unlock(); 676 return err; 677 } 678 679 if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN || 680 sdata->vif.type == IEEE80211_IF_TYPE_AP) 681 ieee80211_send_layer2_update(sta); 682 683 rcu_read_unlock(); 684 |
|
661 return 0; 662} 663 664static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, 665 u8 *mac) 666{ 667 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 668 struct ieee80211_local *local = sdata->local; --- 243 unchanged lines hidden --- | 685 return 0; 686} 687 688static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, 689 u8 *mac) 690{ 691 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 692 struct ieee80211_local *local = sdata->local; --- 243 unchanged lines hidden --- |