aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-07-18 16:16:26 +0300
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:19:49 -0600
commit1f125d14880657a527207b1c3379959d10d9dfe0 (patch)
treecda3dc815a3b85752376ada4d82a0cb907035bd1
parent8ddc4546d19057b985b7de9f70dd3e6f8b807f6d (diff)
downloadandroid_external_wpa_supplicant_8-1f125d14880657a527207b1c3379959d10d9dfe0.tar.gz
android_external_wpa_supplicant_8-1f125d14880657a527207b1c3379959d10d9dfe0.tar.bz2
android_external_wpa_supplicant_8-1f125d14880657a527207b1c3379959d10d9dfe0.zip
FST: Mark get_mb_ie() return value const
The caller is not expected to free or modify the value since this is returning a reference to a buffer maintained by the upper layer. Change-Id: I72c1f148bd130ea0f8567952e11abd790916728c Signed-off-by: Jouni Malinen <j@w1.fi> Git-commit: a0f04da517a5af848331fd978c1200cea28b6a33 Git-repo: git://w1.fi/srv/git/hostap.git CRs-Fixed: 891455
-rw-r--r--src/ap/hostapd.c2
-rw-r--r--src/fst/fst.h2
-rw-r--r--src/fst/fst_ctrl_iface.c4
-rw-r--r--src/fst/fst_group.c31
-rw-r--r--src/fst/fst_iface.h4
-rw-r--r--src/fst/fst_session.c2
-rw-r--r--wpa_supplicant/wpa_supplicant.c2
7 files changed, 24 insertions, 23 deletions
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 9e7b88f2..fa524a04 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1407,7 +1407,7 @@ static int fst_hostapd_send_action_cb(void *ctx, const u8 *da,
}
-static struct wpabuf * fst_hostapd_get_mb_ie_cb(void *ctx, const u8 *addr)
+static const struct wpabuf * fst_hostapd_get_mb_ie_cb(void *ctx, const u8 *addr)
{
struct hostapd_data *hapd = ctx;
struct sta_info *sta = ap_get_sta(hapd, addr);
diff --git a/src/fst/fst.h b/src/fst/fst.h
index 76c3823d..bfeba636 100644
--- a/src/fst/fst.h
+++ b/src/fst/fst.h
@@ -89,7 +89,7 @@ struct fst_wpa_obj {
* @addr: Address of the STA
* Returns: MB IE buffer, %NULL if no MB IE received from the STA
*/
- struct wpabuf * (*get_mb_ie)(void *ctx, const u8 *addr);
+ const struct wpabuf * (*get_mb_ie)(void *ctx, const u8 *addr);
/**
* update_mb_ie - Update last MB IE received from STA
diff --git a/src/fst/fst_ctrl_iface.c b/src/fst/fst_ctrl_iface.c
index 8fe8fb29..eefdc963 100644
--- a/src/fst/fst_ctrl_iface.c
+++ b/src/fst/fst_ctrl_iface.c
@@ -560,7 +560,7 @@ static int get_peer_mbies(const char *params, char *buf, size_t buflen)
u8 peer_addr[ETH_ALEN];
struct fst_group *g;
struct fst_iface *iface = NULL;
- struct wpabuf *mbies;
+ const struct wpabuf *mbies;
if (fst_read_next_text_param(params, ifname, sizeof(ifname), &endp) ||
!*ifname)
@@ -659,7 +659,7 @@ static const char * band_freq(enum mb_band_id band)
static int print_band(unsigned num, struct fst_iface *iface, const u8 *addr,
char *buf, size_t buflen)
{
- struct wpabuf *wpabuf;
+ const struct wpabuf *wpabuf;
enum hostapd_hw_mode hw_mode;
u8 channel;
int ret = 0;
diff --git a/src/fst/fst_group.c b/src/fst/fst_group.c
index 9718e4e8..f6c7be94 100644
--- a/src/fst/fst_group.c
+++ b/src/fst/fst_group.c
@@ -314,21 +314,22 @@ fst_group_does_iface_appear_in_other_mbies(struct fst_group *g,
addr = fst_iface_get_peer_first(other, &ctx, TRUE);
for (; addr; addr = fst_iface_get_peer_next(other, &ctx, TRUE)) {
- struct wpabuf *mbies = fst_iface_get_peer_mb_ie(other, addr);
-
- if (mbies) {
- u8 other_iface_peer_addr[ETH_ALEN];
- struct fst_iface *other_new_iface =
- fst_group_get_new_iface_by_mbie_and_band_id(
- g,
- wpabuf_head(mbies), wpabuf_len(mbies),
- iface_band_id, other_iface_peer_addr);
- if (other_new_iface == iface &&
- os_memcmp(iface_addr, other_iface_peer_addr,
- ETH_ALEN)) {
- os_memcpy(peer_addr, addr, ETH_ALEN);
- return TRUE;
- }
+ const struct wpabuf *mbies;
+ u8 other_iface_peer_addr[ETH_ALEN];
+ struct fst_iface *other_new_iface;
+
+ mbies = fst_iface_get_peer_mb_ie(other, addr);
+ if (!mbies)
+ continue;
+
+ other_new_iface = fst_group_get_new_iface_by_mbie_and_band_id(
+ g, wpabuf_head(mbies), wpabuf_len(mbies),
+ iface_band_id, other_iface_peer_addr);
+ if (other_new_iface == iface &&
+ os_memcmp(iface_addr, other_iface_peer_addr,
+ ETH_ALEN) != 0) {
+ os_memcpy(peer_addr, addr, ETH_ALEN);
+ return TRUE;
}
}
diff --git a/src/fst/fst_iface.h b/src/fst/fst_iface.h
index 4ccea8ee..26cb38dd 100644
--- a/src/fst/fst_iface.h
+++ b/src/fst/fst_iface.h
@@ -96,8 +96,8 @@ static inline int fst_iface_send_action(struct fst_iface *i,
return i->iface_obj.send_action(i->iface_obj.ctx, addr, data);
}
-static inline struct wpabuf * fst_iface_get_peer_mb_ie(struct fst_iface *i,
- const u8 *addr)
+static inline const struct wpabuf *
+fst_iface_get_peer_mb_ie(struct fst_iface *i, const u8 *addr)
{
return i->iface_obj.get_mb_ie(i->iface_obj.ctx, addr);
}
diff --git a/src/fst/fst_session.c b/src/fst/fst_session.c
index b2f77203..6ce5e544 100644
--- a/src/fst/fst_session.c
+++ b/src/fst/fst_session.c
@@ -363,7 +363,7 @@ static void fst_session_handle_setup_request(struct fst_iface *iface,
struct fst_iface *new_iface = NULL;
struct fst_group *g;
u8 new_iface_peer_addr[ETH_ALEN];
- struct wpabuf *peer_mbies;
+ const struct wpabuf *peer_mbies;
size_t plen;
if (frame_len < IEEE80211_HDRLEN + 1 + sizeof(*req)) {
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index bc1a10cf..794c17d0 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3777,7 +3777,7 @@ static int wpas_fst_send_action_cb(void *ctx, const u8 *da, struct wpabuf *data)
}
-static struct wpabuf * wpas_fst_get_mb_ie_cb(void *ctx, const u8 *addr)
+static const struct wpabuf * wpas_fst_get_mb_ie_cb(void *ctx, const u8 *addr)
{
struct wpa_supplicant *wpa_s = ctx;