aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlina Friedrichsen <x-alina@gmx.net>2009-02-20 19:27:29 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:54 -0500
commit79f6440c527c61bcd84edfbdeb390841b9fe5095 (patch)
tree90d86bb64fade58b3acdc8b5954b9e9148c963bd /net
parent5f9724dd94d63e26edb02d9f6a4ce1ce35737f14 (diff)
mac80211: Introduce a generic commit() to apply changes
This patch introduces a generic commit() function which initiate a new network joining process. It should be called after some interface config changes, so that the changes get applied more cleanly. Currently set_ssid() and set_bssid() call it. Others can be added in future patches. In version 1 the header files was forgotten, sorry. Signed-off-by: Alina Friedrichsen <x-alina@gmx.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/ibss.c30
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/mlme.c25
3 files changed, 37 insertions, 20 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 1bbfc7029879..aa8937c56285 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -788,6 +788,23 @@ void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata)
788 IEEE80211_IBSS_AUTO_CHANNEL_SEL; 788 IEEE80211_IBSS_AUTO_CHANNEL_SEL;
789} 789}
790 790
791int ieee80211_ibss_commit(struct ieee80211_sub_if_data *sdata)
792{
793 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
794
795 ifibss->flags &= ~IEEE80211_IBSS_PREV_BSSID_SET;
796
797 if (ifibss->ssid_len)
798 ifibss->flags |= IEEE80211_IBSS_SSID_SET;
799 else
800 ifibss->flags &= ~IEEE80211_IBSS_SSID_SET;
801
802 ifibss->ibss_join_req = jiffies;
803 ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
804
805 return ieee80211_sta_find_ibss(sdata);
806}
807
791int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len) 808int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len)
792{ 809{
793 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 810 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
@@ -801,16 +818,7 @@ int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, siz
801 ifibss->ssid_len = len; 818 ifibss->ssid_len = len;
802 } 819 }
803 820
804 ifibss->flags &= ~IEEE80211_IBSS_PREV_BSSID_SET; 821 return ieee80211_ibss_commit(sdata);
805
806 if (len)
807 ifibss->flags |= IEEE80211_IBSS_SSID_SET;
808 else
809 ifibss->flags &= ~IEEE80211_IBSS_SSID_SET;
810
811 ifibss->ibss_join_req = jiffies;
812 ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
813 return ieee80211_sta_find_ibss(sdata);
814} 822}
815 823
816int ieee80211_ibss_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len) 824int ieee80211_ibss_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len)
@@ -842,7 +850,7 @@ int ieee80211_ibss_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
842 } 850 }
843 } 851 }
844 852
845 return ieee80211_ibss_set_ssid(sdata, ifibss->ssid, ifibss->ssid_len); 853 return ieee80211_ibss_commit(sdata);
846} 854}
847 855
848/* scan finished notification */ 856/* scan finished notification */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d06c75720ced..ecbc8e0cb3e7 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -934,6 +934,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
934ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, 934ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata,
935 struct sk_buff *skb, 935 struct sk_buff *skb,
936 struct ieee80211_rx_status *rx_status); 936 struct ieee80211_rx_status *rx_status);
937int ieee80211_sta_commit(struct ieee80211_sub_if_data *sdata);
937int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len); 938int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
938int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len); 939int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len);
939int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid); 940int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
@@ -944,6 +945,7 @@ void ieee80211_send_pspoll(struct ieee80211_local *local,
944 struct ieee80211_sub_if_data *sdata); 945 struct ieee80211_sub_if_data *sdata);
945 946
946/* IBSS code */ 947/* IBSS code */
948int ieee80211_ibss_commit(struct ieee80211_sub_if_data *sdata);
947int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len); 949int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
948int ieee80211_ibss_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len); 950int ieee80211_ibss_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len);
949int ieee80211_ibss_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid); 951int ieee80211_ibss_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 5a4977936f6f..7f238589b6ff 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1855,6 +1855,20 @@ void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata)
1855 } 1855 }
1856} 1856}
1857 1857
1858int ieee80211_sta_commit(struct ieee80211_sub_if_data *sdata)
1859{
1860 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
1861
1862 ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
1863
1864 if (ifmgd->ssid_len)
1865 ifmgd->flags |= IEEE80211_STA_SSID_SET;
1866 else
1867 ifmgd->flags &= ~IEEE80211_STA_SSID_SET;
1868
1869 return 0;
1870}
1871
1858int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len) 1872int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len)
1859{ 1873{
1860 struct ieee80211_if_managed *ifmgd; 1874 struct ieee80211_if_managed *ifmgd;
@@ -1870,14 +1884,7 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
1870 ifmgd->ssid_len = len; 1884 ifmgd->ssid_len = len;
1871 } 1885 }
1872 1886
1873 ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET; 1887 return ieee80211_sta_commit(sdata);
1874
1875 if (len)
1876 ifmgd->flags |= IEEE80211_STA_SSID_SET;
1877 else
1878 ifmgd->flags &= ~IEEE80211_STA_SSID_SET;
1879
1880 return 0;
1881} 1888}
1882 1889
1883int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len) 1890int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len)
@@ -1907,7 +1914,7 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
1907 } 1914 }
1908 } 1915 }
1909 1916
1910 return ieee80211_sta_set_ssid(sdata, ifmgd->ssid, ifmgd->ssid_len); 1917 return ieee80211_sta_commit(sdata);
1911} 1918}
1912 1919
1913int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len) 1920int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len)