linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alina Friedrichsen" <x-alina@gmx.net>
To: linux-wireless@vger.kernel.org, linville@tuxdriver.com,
	johannes@sipsolutions.net
Subject: [PATCH] mac80211: Introduce a generic commit() to apply changes
Date: Sat, 21 Feb 2009 01:12:23 +0100	[thread overview]
Message-ID: <20090221001223.65910@gmx.net> (raw)

This patch introduces a generic commit() function which initiate a new =
network joining process. It should be called after some interface confi=
g changes, so that the changes get applied more cleanly. Currently set_=
ssid() and set_bssid() call it. Others can be added in future patches.

Signed-off-by: Alina Friedrichsen <x-alina@gmx.net>
---
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 1bbfc70..aa8937c 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -788,6 +788,23 @@ void ieee80211_ibss_setup_sdata(struct ieee80211_s=
ub_if_data *sdata)
 			IEEE80211_IBSS_AUTO_CHANNEL_SEL;
 }
=20
+int ieee80211_ibss_commit(struct ieee80211_sub_if_data *sdata)
+{
+	struct ieee80211_if_ibss *ifibss =3D &sdata->u.ibss;
+
+	ifibss->flags &=3D ~IEEE80211_IBSS_PREV_BSSID_SET;
+
+	if (ifibss->ssid_len)
+		ifibss->flags |=3D IEEE80211_IBSS_SSID_SET;
+	else
+		ifibss->flags &=3D ~IEEE80211_IBSS_SSID_SET;
+
+	ifibss->ibss_join_req =3D jiffies;
+	ifibss->state =3D IEEE80211_IBSS_MLME_SEARCH;
+
+	return ieee80211_sta_find_ibss(sdata);
+}
+
 int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char =
*ssid, size_t len)
 {
 	struct ieee80211_if_ibss *ifibss =3D &sdata->u.ibss;
@@ -801,16 +818,7 @@ int ieee80211_ibss_set_ssid(struct ieee80211_sub_i=
f_data *sdata, char *ssid, siz
 		ifibss->ssid_len =3D len;
 	}
=20
-	ifibss->flags &=3D ~IEEE80211_IBSS_PREV_BSSID_SET;
-
-	if (len)
-		ifibss->flags |=3D IEEE80211_IBSS_SSID_SET;
-	else
-		ifibss->flags &=3D ~IEEE80211_IBSS_SSID_SET;
-
-	ifibss->ibss_join_req =3D jiffies;
-	ifibss->state =3D IEEE80211_IBSS_MLME_SEARCH;
-	return ieee80211_sta_find_ibss(sdata);
+	return ieee80211_ibss_commit(sdata);
 }
=20
 int 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_i=
f_data *sdata, u8 *bssid)
 		}
 	}
=20
-	return ieee80211_ibss_set_ssid(sdata, ifibss->ssid, ifibss->ssid_len)=
;
+	return ieee80211_ibss_commit(sdata);
 }
=20
 /* scan finished notification */
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 5a49779..7f23858 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)
 	}
 }
=20
+int ieee80211_sta_commit(struct ieee80211_sub_if_data *sdata)
+{
+	struct ieee80211_if_managed *ifmgd =3D &sdata->u.mgd;
+
+	ifmgd->flags &=3D ~IEEE80211_STA_PREV_BSSID_SET;
+
+	if (ifmgd->ssid_len)
+		ifmgd->flags |=3D IEEE80211_STA_SSID_SET;
+	else
+		ifmgd->flags &=3D ~IEEE80211_STA_SSID_SET;
+
+	return 0;
+}
+
 int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *=
ssid, size_t len)
 {
 	struct ieee80211_if_managed *ifmgd;
@@ -1870,14 +1884,7 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_=
if_data *sdata, char *ssid, size
 		ifmgd->ssid_len =3D len;
 	}
=20
-	ifmgd->flags &=3D ~IEEE80211_STA_PREV_BSSID_SET;
-
-	if (len)
-		ifmgd->flags |=3D IEEE80211_STA_SSID_SET;
-	else
-		ifmgd->flags &=3D ~IEEE80211_STA_SSID_SET;
-
-	return 0;
+	return ieee80211_sta_commit(sdata);
 }
=20
 int 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)
 		}
 	}
=20
-	return ieee80211_sta_set_ssid(sdata, ifmgd->ssid, ifmgd->ssid_len);
+	return ieee80211_sta_commit(sdata);
 }
=20
 int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, ch=
ar *ie, size_t len)

--=20
Psssst! Schon vom neuen GMX MultiMessenger geh=F6rt? Der kann`s mit all=
en: http://www.gmx.net/de/go/multimessenger01
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

                 reply	other threads:[~2009-02-21  0:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090221001223.65910@gmx.net \
    --to=x-alina@gmx.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).