]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
FST: Mark get_mb_ie() return value const
authorJouni Malinen <j@w1.fi>
Sat, 18 Jul 2015 13:16:26 +0000 (16:16 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 18 Jul 2015 14:23:55 +0000 (17:23 +0300)
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.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/hostapd.c
src/fst/fst.h
src/fst/fst_ctrl_iface.c
src/fst/fst_group.c
src/fst/fst_iface.h
src/fst/fst_session.c
wpa_supplicant/wpa_supplicant.c

index 0fad6430504ef8e4821431b9da8493be424455c2..bcd6ce003a1892150d1e8713c94d685c5326d284 100644 (file)
@@ -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);
index 76c3823d1382d9eb11e21d67728c34a130a0698b..bfeba6367605d712872b7efe5b3ef7382b3e30e1 100644 (file)
@@ -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
index 8fe8fb2999223c82127565d35fd744142f9d37c2..eefdc9632ad23a4b1cd04b84de9aba5c3399c147 100644 (file)
@@ -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;
index 9718e4e88ac8af818af6966358b371f5ecc328f9..f6c7be9435f412938c12e126f835d8a07fdd8f9b 100644 (file)
@@ -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;
                }
        }
 
index 4ccea8eedcc04ae9083dcca317f4e94f7e031724..26cb38dddc4dfe487002f13a64261facf30e91ea 100644 (file)
@@ -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);
 }
index b2f77203a94ed3ba7597018effd7fc04f4043941..6ce5e544f3d96e07914f64b4d7ab32e782a3581f 100644 (file)
@@ -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))  {
index 210e33aee700ec0374f61311d0bd8aa7a30bad0c..24c3e5a2e3640c4d9830302525dcc115428f2ca4 100644 (file)
@@ -3772,7 +3772,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;